SwatDB
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Variables
swatdb_types.h File Reference
#include <cstdint>
#include <string>
Include dependency graph for swatdb_types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PageId
 
struct  RecordId
 
struct  FieldEntry
 
struct  SelectConjunct
 

Typedefs

typedef std::uint32_t FileId
 
typedef std::uint32_t PageNum
 
typedef std::uint32_t FrameId
 Index of each frame in the bufferpool of BufferManager.
 
typedef std::uint32_t SlotId
 
typedef std::uint32_t FieldId
 
typedef std::uint16_t FieldOffset
 
typedef std::uint32_t Level
 
typedef std::uint32_t HashVal
 

Enumerations

enum  FieldType { IntFieldT , FloatFieldT , StringFieldT , InvalidFieldT }
 
enum  CatType {
  INVALID_CAT_TYPE , HeapFileT , SortedFileT , BPlusTreeT ,
  HashIndexT
}
 
enum  Comp {
  INVALID_TYPE , LESS , GREATER , EQUAL ,
  NOT_EQUAL , LESS_EQUAL , GREATER_EQUAL
}
 
enum  RepType {
  INVALID_REP_TYPE , ClockT , RandomT , MruT ,
  ClockRandomT , LruT , MAXREPTYPES
}
 
enum  SelectType { INVALID_SELECT_TYPE , FileScanT , IndexT }
 
enum  JoinType {
  INVALID_JOIN_TYPE , TupleNLJT , IndexNLJT , BlockNLJT ,
  SeqHashJoinT , ParHashJoinT
}
 

Variables

const int BM_MAX_REP_STR_LEN = (48)
 
const char bm_rep_strs [MAXREPTYPES][BM_MAX_REP_STR_LEN]
 
const std::uint32_t FILE_MAX_CAPACITY = 100000000
 
const std::uint32_t MAX_FILE_NUM = 1000
 
const std::uint32_t PAGE_SIZE = 1024
 
const std::uint32_t MAX_RECORD_SIZE = PAGE_SIZE - (8 * sizeof(std::uint32_t))
 
const std::uint32_t MAX_PAGE_NUM
 
const std::uint32_t MAX_FILE_NAME_LEN = 511
 
const std::uint32_t BUF_SIZE = 1024
 
const std::uint32_t MAX_FIELD_NAME = 32
 
const std::uint32_t INVALID_PAGE_NUM = MAX_PAGE_NUM+1
 
const std::uint32_t HEADER_PAGE_NUM = 0
 
const std::uint32_t INVALID_FILE_ID = MAX_FILE_NUM+1
 
const PageId INVALID_PAGE_ID = {INVALID_FILE_ID, INVALID_PAGE_NUM}
 
const std::uint32_t INVALID_SLOT_OFFSET = PAGE_SIZE+1
 
const SlotId INVALID_SLOT_ID = INVALID_SLOT_OFFSET
 
const RecordId INVALID_RECORD_ID = {INVALID_PAGE_NUM, INVALID_SLOT_ID}
 
const float MAX_HEAP_PAGE_LOAD = 0.9
 
const float MAX_HASH_BUCKET_LOAD = 0.9
 
const SlotId MAX_HASH_DIRSLOT = PAGE_SIZE/sizeof(PageNum)
 

Typedef Documentation

◆ FieldId

typedef std::uint32_t FieldId

Unique identifer of each field in a record

◆ FieldOffset

typedef std::uint16_t FieldOffset

Offset of the field within a record/key per variable length implementation

◆ FileId

typedef std::uint32_t FileId

SwatDB Types and Configuration. Definition of commonly used data types and constants used throughout the system Types defined by specific layers may be defined in interface .h files. Runtime unique identifer of each file. Reset everytime the system is rebooted.

◆ HashVal

typedef std::uint32_t HashVal

Hash value of a key/field

◆ Level

typedef std::uint32_t Level

Level of HashIndex

◆ PageNum

typedef std::uint32_t PageNum

Unique identifer of each page in a single Unix file.

Enumeration Type Documentation

◆ CatType

enum CatType

Catalog entry types: one for each type of file or index in the system IMPORTANT: since the type is encoded in saved meta files on disk, you should ONLY APPEND to this list (don't remove a type, nor add a new one in the middle)

◆ FieldType

enum FieldType

Record field types

◆ JoinType

enum JoinType

Defines the type of joins that can be run in the relops manager

◆ RepType

enum RepType

Buffer Manager Replacement Policy types: one for each type of replacement policy

◆ SelectType

enum SelectType

Defines the type of selects that can be run in the relops manager

Variable Documentation

◆ BM_MAX_REP_STR_LEN

const int BM_MAX_REP_STR_LEN = (48)

sets max size of string representation of replacment policies (used for print output)

◆ bm_rep_strs

const char bm_rep_strs[MAXREPTYPES][BM_MAX_REP_STR_LEN]
Initial value:
= { "Invalid",
"Clock",
"Random",
"MRU",
"ClockRandom",
"LRU"
}

String reprentations of Buffer Manager Replacement Policies add one for each RepType entry this is indexed by the RepType value, so be careful!

◆ BUF_SIZE

const std::uint32_t BUF_SIZE = 1024

Number of pages that can be held in the buffer pool.

◆ FILE_MAX_CAPACITY

const std::uint32_t FILE_MAX_CAPACITY = 100000000

SwatDB Constants Maximum capacity of each Unix file in bytes

◆ HEADER_PAGE_NUM

const std::uint32_t HEADER_PAGE_NUM = 0

PageNum of header page. Is 0 by default per the current implementation, but may change in the future.

◆ INVALID_FILE_ID

const std::uint32_t INVALID_FILE_ID = MAX_FILE_NUM+1

Default constant for PageNum that exceeds its maximum.

◆ INVALID_PAGE_ID

const PageId INVALID_PAGE_ID = {INVALID_FILE_ID, INVALID_PAGE_NUM}

Used for initializing a PageId to a default value that is not used

◆ INVALID_PAGE_NUM

const std::uint32_t INVALID_PAGE_NUM = MAX_PAGE_NUM+1

Default constant for FileId that exceeds its maximum.

◆ INVALID_RECORD_ID

const RecordId INVALID_RECORD_ID = {INVALID_PAGE_NUM, INVALID_SLOT_ID}

Default value of RecordId.

◆ INVALID_SLOT_ID

const SlotId INVALID_SLOT_ID = INVALID_SLOT_OFFSET

Default value of SlotId.

◆ INVALID_SLOT_OFFSET

const std::uint32_t INVALID_SLOT_OFFSET = PAGE_SIZE+1

Value slot offset of SlotInfo is set to when the slot is not valid. Used by inherited classes of Page class

◆ MAX_FIELD_NAME

const std::uint32_t MAX_FIELD_NAME = 32

The maximum sizeof any field name

◆ MAX_FILE_NAME_LEN

const std::uint32_t MAX_FILE_NAME_LEN = 511

Maximum length of a file name string in the system (not counting \0)

◆ MAX_FILE_NUM

const std::uint32_t MAX_FILE_NUM = 1000

Maximum number of Unix files that can be created during one run of SwatDB (a real long running system would have much larger value for this)

◆ MAX_HASH_BUCKET_LOAD

const float MAX_HASH_BUCKET_LOAD = 0.9

Maximum load factor (free space/total space) of hash bucket page. If the load factor of a hash bucket page exceeds this value, it is considered full.

◆ MAX_HASH_DIRSLOT

const SlotId MAX_HASH_DIRSLOT = PAGE_SIZE/sizeof(PageNum)

The maximum number of entries that could fit on a hash directory page.

◆ MAX_HEAP_PAGE_LOAD

const float MAX_HEAP_PAGE_LOAD = 0.9

Maximum load factor (free space/total space) of heap page. If the load factor of a heappage exceeds this value, it is considered full.

◆ MAX_PAGE_NUM

const std::uint32_t MAX_PAGE_NUM
Initial value:
= ((8*(FILE_MAX_CAPACITY -sizeof(std::uint32_t)
*2))/(8*PAGE_SIZE+1))-1
const std::uint32_t FILE_MAX_CAPACITY
Definition swatdb_types.h:241
const std::uint32_t PAGE_SIZE
Definition swatdb_types.h:258

Maximum number of pages that could fit in a single Unix file, excluding the file header metadata. If the size of the SerializedFileHeader struct is modified, this equation also has to be modified. This equation accounts for extra space occupied by 2 std::uint32_t (size and capacity) fields of the header metadata and space occupied by bitmap (1 bit per Page, but 8 is multiplied to prevent truncation due to int division). Finally, the MAX_PAGE_NUM is "rounded down" as the disk header information has to fit in units of PAGE_SIZE.

◆ MAX_RECORD_SIZE

const std::uint32_t MAX_RECORD_SIZE = PAGE_SIZE - (8 * sizeof(std::uint32_t))

The maximum record size that can fit in a single page. It accounts for the minimum space taken by the metadata of HeapPage, so if metadata structures are modified, this value should also be modified.

◆ PAGE_SIZE

const std::uint32_t PAGE_SIZE = 1024

The size of a page in bytes