BadgerDB
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
Classes | Typedefs | Enumerations | Functions | Variables
badgerdb Namespace Reference

Classes

class  RIDKeyPair
 Structure to store a key-rid pair. It is used to pass the pair to functions that add to or make changes to the leaf node pages of the tree. Is templated for the key member. More...
 
class  PageKeyPair
 Structure to store a key page pair which is used to pass the key and page to functions that make any modifications to the non leaf pages of the tree. More...
 
struct  IndexMetaInfo
 The meta page, which holds metadata for Index file, is always first page of the btree index file and is cast to the following structure to store or retrieve information from it. Contains the relation name for which the index is created, the byte offset of the key value on which the index is made, the type of the key and the page no of the root page. Root page starts as page 2 but since a split can occur at the root the root page may get moved up and get a new page no. More...
 
struct  NonLeafNodeInt
 Structure for all non-leaf nodes when the key is of INTEGER type. More...
 
struct  NonLeafNodeDouble
 Structure for all non-leaf nodes when the key is of DOUBLE type. More...
 
struct  NonLeafNodeString
 Structure for all non-leaf nodes when the key is of STRING type. More...
 
struct  LeafNodeInt
 Structure for all leaf nodes when the key is of INTEGER type. More...
 
struct  LeafNodeDouble
 Structure for all leaf nodes when the key is of DOUBLE type. More...
 
struct  LeafNodeString
 Structure for all leaf nodes when the key is of STRING type. More...
 
class  BTreeIndex
 BTreeIndex class. It implements a B+ Tree index on a single attribute of a relation. This index supports only one scan at a time. More...
 
class  BufDesc
 Class for maintaining information about buffer pool frames. More...
 
struct  BufStats
 Class to maintain statistics of buffer usage. More...
 
class  BufMgr
 The central class which manages the buffer pool including frame allocation and deallocation to pages in the file. More...
 
struct  hashBucket
 Declarations for buffer pool hash table. More...
 
class  BufHashTbl
 Hash table class to keep track of pages in the buffer pool. More...
 
class  BadBufferException
 An exception that is thrown when a buffer is found whose valid is false but other variables in BufDesc are assigned valid values. More...
 
class  BadIndexInfoException
 An exception that is thrown when a file operation is requested for a filename that doesn't exist. More...
 
class  BadOpcodesException
 An exception that is thrown when some unexpected error occurs in the hash table. More...
 
class  BadScanParamException
 An exception that is thrown when some unexpected error occurs in the hash table. More...
 
class  BadScanrangeException
 An exception that is thrown when some unexpected error occurs in the hash table. More...
 
class  BadgerDbException
 Base class for all BadgerDB-specific exceptions. More...
 
class  BufferExceededException
 An exception that is thrown when buffer capacity is exceeded. More...
 
class  EndOfFileException
 An exception that is thrown when some unexpected error occurs in the hash table. More...
 
class  FileExistsException
 An exception that is thrown when a file creation is requested for a filename that already exists. More...
 
class  FileNotFoundException
 An exception that is thrown when a file operation is requested for a filename that doesn't exist. More...
 
class  FileOpenException
 An exception that is thrown when a file deletion is requested for a filename that's currently open. More...
 
class  HashAlreadyPresentException
 An exception that is thrown when a new entry to be inserted in the hash table is already present in it. More...
 
class  HashNotFoundException
 An exception that is thrown when an entry being looked up in the hash table is not present in it. More...
 
class  HashTableException
 An exception that is thrown when some unexpected error occurs in the hash table. More...
 
class  IndexScanCompletedException
 An exception that is thrown when a file operation is requested for a filename that doesn't exist. More...
 
class  InsufficientSpaceException
 An exception that is thrown when a record is attempted to be inserted into a page that doesn't have space for it. More...
 
class  InvalidPageException
 An exception that is thrown when an attempt is made to access an invalid page in a file. More...
 
class  InvalidRecordException
 An exception that is thrown when a record is requested from a page that has a bad record ID. More...
 
class  InvalidSlotException
 An exception that is thrown when a slot that doesn't have data is requested from a page. More...
 
class  NoSuchKeyFoundException
 An exception that is thrown when a file operation is requested for a filename that doesn't exist. More...
 
class  PageNotPinnedException
 An exception that is thrown when a page which is expected to be pinned in the buffer pool is found to be not pinned. More...
 
class  PagePinnedException
 An exception that is thrown when a page which is not expected to be pinned in the buffer pool is found to be pinned. More...
 
class  ScanNotInitializedException
 An exception that is thrown when a file operation is requested for a filename that doesn't exist. More...
 
class  SlotInUseException
 An exception that is thrown when a record is attempted to be inserted into a slot that is already in use. More...
 
struct  FileHeader
 Header metadata for files on disk which contain pages. More...
 
class  File
 Class which represents a file in the filesystem containing database pages. More...
 
class  PageFile
 
class  BlobFile
 
class  FileIterator
 Iterator for iterating over the pages in a file. More...
 
class  FileScan
 This class is used to sequentially scan records in a relation. More...
 
struct  PageHeader
 Header metadata in a page. More...
 
struct  PageSlot
 Slot metadata that tracks where a record is in the data space. More...
 
class  Page
 Class which represents a fixed-size database page containing records. More...
 
class  PageIterator
 Iterator for iterating over the records in a page. More...
 
struct  RecordId
 Identifier for a record in a page. More...
 

Typedefs

typedef std::uint32_t PageId
 Identifier for a page in a file. More...
 
typedef std::uint16_t SlotId
 Identifier for a slot in a page. More...
 
typedef std::uint32_t FrameId
 Identifier for a frame in buffer pool. More...
 

Enumerations

enum  Datatype { INTEGER = 0, DOUBLE = 1, STRING = 2 }
 Datatype enumeration type. More...
 
enum  Operator { LT, LTE, GTE, GT }
 Scan operations enumeration. Passed to BTreeIndex::startScan() method. More...
 

Functions

template<class T >
bool operator< (const RIDKeyPair< T > &r1, const RIDKeyPair< T > &r2)
 Overloaded operator to compare the key values of two rid-key pairs and if they are the same compares to see if the first pair has a smaller rid.pageNo value. More...
 

Variables

const int STRINGSIZE = 10
 Size of String key. More...
 
const int INTARRAYLEAFSIZE = ( Page::SIZE - sizeof( PageId ) ) / ( sizeof( int ) + sizeof( RecordId ) )
 Number of key slots in B+Tree leaf for INTEGER key. More...
 
const int DOUBLEARRAYLEAFSIZE = ( Page::SIZE - sizeof( PageId ) ) / ( sizeof( double ) + sizeof( RecordId ) )
 Number of key slots in B+Tree leaf for DOUBLE key. More...
 
const int STRINGARRAYLEAFSIZE = ( Page::SIZE - sizeof( PageId ) ) / ( 10 * sizeof(char) + sizeof( RecordId ) )
 Number of key slots in B+Tree leaf for STRING key. More...
 
const int INTARRAYNONLEAFSIZE = ( Page::SIZE - sizeof( int ) - sizeof( PageId ) ) / ( sizeof( int ) + sizeof( PageId ) )
 Number of key slots in B+Tree non-leaf for INTEGER key. More...
 
const int DOUBLEARRAYNONLEAFSIZE = (( Page::SIZE - sizeof( int ) - sizeof( PageId ) ) / ( sizeof( double ) + sizeof( PageId ) )) - 1
 Number of key slots in B+Tree leaf for DOUBLE key. More...
 
const int STRINGARRAYNONLEAFSIZE = ( Page::SIZE - sizeof( int ) - sizeof( PageId ) ) / ( 10 * sizeof(char) + sizeof( PageId ) )
 Number of key slots in B+Tree leaf for STRING key. More...
 

Detailed Description

Author
See Contributors.txt for code contributors and overview of BadgerDB.

LICENSE

Copyright (c) 2012 Database Group, Computer Sciences Department, University of Wisconsin-Madison.

Typedef Documentation

typedef std::uint32_t badgerdb::FrameId

Identifier for a frame in buffer pool.

Definition at line 25 of file types.h.

typedef std::uint32_t badgerdb::PageId

Identifier for a page in a file.

Definition at line 15 of file types.h.

typedef std::uint16_t badgerdb::SlotId

Identifier for a slot in a page.

Definition at line 20 of file types.h.

Enumeration Type Documentation

Datatype enumeration type.

Definition at line 26 of file btree.h.

27 {
28  INTEGER = 0,
29  DOUBLE = 1,
30  STRING = 2
31 };

Scan operations enumeration. Passed to BTreeIndex::startScan() method.

Definition at line 36 of file btree.h.

37 {
38  LT, /* Less Than */
39  LTE, /* Less Than or Equal to */
40  GTE, /* Greater Than or Equal to */
41  GT /* Greater Than */
42 };

Function Documentation

template<class T >
bool badgerdb::operator< ( const RIDKeyPair< T > &  r1,
const RIDKeyPair< T > &  r2 
)

Overloaded operator to compare the key values of two rid-key pairs and if they are the same compares to see if the first pair has a smaller rid.pageNo value.

Definition at line 123 of file btree.h.

124 {
125  if( r1.key != r2.key )
126  return r1.key < r2.key;
127  else
128  return r1.rid.page_number < r2.rid.page_number;
129 }

Variable Documentation

const int badgerdb::DOUBLEARRAYLEAFSIZE = ( Page::SIZE - sizeof( PageId ) ) / ( sizeof( double ) + sizeof( RecordId ) )

Number of key slots in B+Tree leaf for DOUBLE key.

Definition at line 59 of file btree.h.

const int badgerdb::DOUBLEARRAYNONLEAFSIZE = (( Page::SIZE - sizeof( int ) - sizeof( PageId ) ) / ( sizeof( double ) + sizeof( PageId ) )) - 1

Number of key slots in B+Tree leaf for DOUBLE key.

Definition at line 77 of file btree.h.

const int badgerdb::INTARRAYLEAFSIZE = ( Page::SIZE - sizeof( PageId ) ) / ( sizeof( int ) + sizeof( RecordId ) )

Number of key slots in B+Tree leaf for INTEGER key.

Definition at line 53 of file btree.h.

const int badgerdb::INTARRAYNONLEAFSIZE = ( Page::SIZE - sizeof( int ) - sizeof( PageId ) ) / ( sizeof( int ) + sizeof( PageId ) )

Number of key slots in B+Tree non-leaf for INTEGER key.

Definition at line 71 of file btree.h.

const int badgerdb::STRINGARRAYLEAFSIZE = ( Page::SIZE - sizeof( PageId ) ) / ( 10 * sizeof(char) + sizeof( RecordId ) )

Number of key slots in B+Tree leaf for STRING key.

Definition at line 65 of file btree.h.

const int badgerdb::STRINGARRAYNONLEAFSIZE = ( Page::SIZE - sizeof( int ) - sizeof( PageId ) ) / ( 10 * sizeof(char) + sizeof( PageId ) )

Number of key slots in B+Tree leaf for STRING key.

Definition at line 83 of file btree.h.

const int badgerdb::STRINGSIZE = 10

Size of String key.

Definition at line 47 of file btree.h.