Skip to content

Latest commit

 

History

History
756 lines (462 loc) · 44.6 KB

File metadata and controls

756 lines (462 loc) · 44.6 KB

Summary

Members Descriptions
define RELATIVE_LEFT An position relative to the left.
define RELATIVE_MIDDLE An position relative to the middle.
define RELATIVE_RIGHT An position relative to the right.
define FIELD_TITLE_MAX_SIZE Max size of the article title.
define FIELD_AUTHORS_MAX_SIZE Max size of the article authors' names.
define FIELD_DATE_MAX_SIZE Max size of the article date.
define FIELD_SNIPPET_MAX_SIZE Max size of the article snippet.
define BLOCK_SIZE Preset block size.
define RECORD_HEADER_SIZE Preset record header size.
define RECORD_TAIL_SIZE Preset record header size.
define RECORD_AREA_SIZE Preset record area size, containing the data.
define DATA_LOCATION
define TAIL_LOCATION Preset tail location.
define VERIFICATION_MASK The mask used for validation.
define R_NOTHING The two characters are nothing in special.
define R_SOR The two characters means START OF RECORD.
define R_EOC The two characters means END OF RECORD.
define R_SON The two characters means START OF NULL.
define IOHANDLER_READY READY state of the buffer reading.
define IOHANDLER_SLEEPING SLEEPING state of the buffer reading.
define IOHANDLER_END END state of the buffer reading.
define IOHANDLER_READ_BUFFER_SIZE IOHandler reading buffer size (block size)
define PRIMARY_MAX_KEYS Max keys count.
define PRIMARY_RIGHT_MIDDLE_KEY The position of the middle key.
define PRIMARY_LEFT_MIDDLE_KEY The block pointers count.
define PRIMARY_HALF_MAX_KEYS The half count of the maxium keys count.
define SECONDARY_MAX_KEYS Max keys count.
define SECONDARY_RIGHT_MIDDLE_KEY The position of the middle key.
define SECONDARY_LEFT_MIDDLE_KEY The block pointers count.
define SECONDARY_HALF_MAX_KEYS The half count of the maxium keys count.
define SECONDARY_KEY_LENGTH The size of the key.
define BYTE Binding for unsigned char.
define BYTE_BITS Byte size in bits.
define SHORT_SIZE Short size in bytes.
define INT_SIZE Int size in bytes.
define LONG_SIZE Long size in bytes.
define BYTE_SIZE Byte size in bytes (?)
public template<typename T,typename K>
inline static int upperBound(T * array,int length,K value)
Perform a binary search on the array : receive na array, a length and a value : a pair, the first paramether regards if the search has found the value, false if it hasn't been found; the second paramether regards the index in the array Perform a upper_bound search on the array : receive na array, a length and a value : a integer showing where the value must be placed
public template<typename T,typename K>
inline static int lowerBound(T * array,int length,K value)
Perform a lower_bound search on the array : receive na array, a length and a value : a integer showing where the value must be placed
public template<typename T,typename K>
inline static std::pair< bool, int > binarySearch(T * array,int length,K value)
Retrieves and return the index where the value must be placed
public template<typename T,typename K>
inline static std::pair< bool, int > secondaryBinarySearch(T * array,int length,K value)
Retrieves and return the index where the value must be placed
public template<typename T>
inline static std::pair< bool, unsigned short > orderedInsert(T * array,unsigned short & length,T & value)
Perform a ordered insert : receive an array, a length and a value : void
public void printAll(Block_t & block,FILE * indexFile,BlockDerreference * derreference)
public int main()
public int main(int argc,char * argv)
public bool getArticleFromHash(int id,Article_t * article,FILE * toRead) Retrieves and return an article from the file using the id
public bool getArticleFromHash(int id,Article_t * article,FILE * toRead) Retrieves and return the article from the hash file
public inline static char after_pairClass(char previous,char current) Second degree verifyer, classify a pair of characters.
public inline static char pairClass(char previous,char current) First degree verifyer, classify a pair of characters.
public inline static void readColumn(FILE * file,char * buffer,char previous) Read a column receiving the file, the buffer and the previous char
public inline static void readNIgnoreColumn(FILE * file,char previous) Read a column receiving the file and the previous char, ignoring the buffer
public inline void writeBackNode(PrimaryBTreeNode * node,int offset,FILE * indexFile) Write a node back into the file
public inline char relativeKeyPosition(int key,int leftMiddle,int rightMiddle) Returns the relative key position based on the extremes
public inline int writeNewNode(PrimaryBTreeNode * node,FILE * indexFile) Write a new node
public inline void writeBackNode(SecondaryBTreeNode * node,int offset,FILE * indexFile) Write a node back into the file
public inline char relativeKeyPosition(SecondaryBTreeDataMap & key,SecondaryBTreeDataMap & leftMiddle,SecondaryBTreeDataMap & rightMiddle) Returns the relative key position based on the extremes
public inline int writeNewNode(SecondaryBTreeNode * node,FILE * indexFile) Write a new node
public int main(int argc,char ** argv)
public int main(int argc,char ** argv)
public int main(int argc,char * argv)
class HashFileFactory A class to recover raw information in the hashed file
class IOHandler A class to read and handle the CSV file, buffering and handleing the fields
class PrimaryBTree A class abstracting the btree
class SecondaryBTree A class abstracting the btree
struct AbstractBlock_t
struct Article_t A struct to embbed and abstract an article and its fields
struct Block_t A struct to embbed and abstract an block, its head, data and tail
struct Header_Interpretation_t::Header Abstract header representation
struct PrimaryBTreeNode A struct used for abstract the concept of node
struct PrimaryBTreeRecursionResponse A struct used for save the response of the recursive insertion method
struct SecondaryBTreeDataMap A struct used for abstract the keymap and the data block
struct SecondaryBTreeNode A struct used for abstract the concept of node
struct SecondaryBTreeRecursionResponse A struct used for save the response of the recursive insertion method
struct Tail_Interpretation_t::Tail Abstract tail representation
union Article_Interpretation_t An union to abstract the reinterpretation of the article onto the block
union BlockDerreference
union Header_Interpretation_t An union to abstract the reinterpretation of the header onto the block
union PrimaryBTreeHeaderReinterpret An union used to represent an interpretation of the header regardins blocks
union PrimaryBTreeNodeReinterpret An union used to represent an interpretation of the node regardins blocks
union SecondaryBTreeHeaderReinterpret An union used to represent an interpretation of the header regardins blocks
union SecondaryBTreeNodeReinterpret An union used to represent an interpretation of the node regardins blocks
union Tail_Interpretation_t An union to abstract the reinterpretation of the tail onto the block

Members

An position relative to the left.

An position relative to the middle.

An position relative to the right.

Max size of the article title.

Max size of the article authors' names.

Max size of the article date.

Max size of the article snippet.

define BLOCK_SIZE

Preset block size.

Preset record header size.

Preset record header size.

Preset record area size, containing the data.

Preset tail location.

The mask used for validation.

define R_NOTHING

The two characters are nothing in special.

define R_SOR

The two characters means START OF RECORD.

define R_EOC

The two characters means END OF RECORD.

define R_SON

The two characters means START OF NULL.

READY state of the buffer reading.

SLEEPING state of the buffer reading.

END state of the buffer reading.

IOHandler reading buffer size (block size)

Max keys count.

The position of the middle key.

The block pointers count.

The half count of the maxium keys count.

Max keys count.

The position of the middle key.

The block pointers count.

The half count of the maxium keys count.

The size of the key.

define BYTE

Binding for unsigned char.

define BYTE_BITS

Byte size in bits.

define SHORT_SIZE

Short size in bytes.

define INT_SIZE

Int size in bytes.

define LONG_SIZE

Long size in bytes.

define BYTE_SIZE

Byte size in bytes (?)

public template<typename T,typename K>
inline static int upperBound(T * array,int length,K value)

Perform a binary search on the array : receive na array, a length and a value : a pair, the first paramether regards if the search has found the value, false if it hasn't been found; the second paramether regards the index in the array Perform a upper_bound search on the array : receive na array, a length and a value : a integer showing where the value must be placed

public template<typename T,typename K>
inline static int lowerBound(T * array,int length,K value)

Perform a lower_bound search on the array : receive na array, a length and a value : a integer showing where the value must be placed

public template<typename T,typename K>
inline static std::pair< bool, int > binarySearch(T * array,int length,K value)

Retrieves and return the index where the value must be placed

public template<typename T,typename K>
inline static std::pair< bool, int > secondaryBinarySearch(T * array,int length,K value)

Retrieves and return the index where the value must be placed

public template<typename T>
inline static std::pair< bool, unsigned short > orderedInsert(T * array,unsigned short & length,T & value)

Perform a ordered insert : receive an array, a length and a value : void

public void printAll(Block_t & block,FILE * indexFile,BlockDerreference * derreference)

public int main()

public int main(int argc,char * argv)

public bool getArticleFromHash(int id,Article_t * article,FILE * toRead)

Retrieves and return an article from the file using the id

public bool getArticleFromHash(int id,Article_t * article,FILE * toRead)

Retrieves and return the article from the hash file

Retrieves and return an article from the file using the id

public inline static char after_pairClass(char previous,char current)

Second degree verifyer, classify a pair of characters.

Classes : R_NOTHING as 0 \ R_SOR as 1 \ R_EOC as 2 \ R_SON as 3 \

public inline static char pairClass(char previous,char current)

First degree verifyer, classify a pair of characters.

Classes : R_NOTHING as 0 \ R_SOR as 1 \ R_EOC as 2 \ R_SON as 3 \

public inline static void readColumn(FILE * file,char * buffer,char previous)

Read a column receiving the file, the buffer and the previous char

public inline static void readNIgnoreColumn(FILE * file,char previous)

Read a column receiving the file and the previous char, ignoring the buffer

public inline void writeBackNode(PrimaryBTreeNode * node,int offset,FILE * indexFile)

Write a node back into the file

public inline char relativeKeyPosition(int key,int leftMiddle,int rightMiddle)

Returns the relative key position based on the extremes

public inline int writeNewNode(PrimaryBTreeNode * node,FILE * indexFile)

Write a new node

public inline void writeBackNode(SecondaryBTreeNode * node,int offset,FILE * indexFile)

Write a node back into the file

public inline char relativeKeyPosition(SecondaryBTreeDataMap & key,SecondaryBTreeDataMap & leftMiddle,SecondaryBTreeDataMap & rightMiddle)

Returns the relative key position based on the extremes

public inline int writeNewNode(SecondaryBTreeNode * node,FILE * indexFile)

Write a new node

public int main(int argc,char ** argv)

public int main(int argc,char ** argv)

public int main(int argc,char * argv)

class HashFileFactory

A class to recover raw information in the hashed file

Summary

Members Descriptions
public void createBinaryFilePerfectHash(FILE * toRead,FILE * toWrite) Create the hashed file using the file on the first paramether to read the CSV format file and the file on the second paramether to write the binary file as a bonus, create the primary index as well xD

Members

public void createBinaryFilePerfectHash(FILE * toRead,FILE * toWrite)

Create the hashed file using the file on the first paramether to read the CSV format file and the file on the second paramether to write the binary file as a bonus, create the primary index as well xD

class IOHandler

A class to read and handle the CSV file, buffering and handleing the fields

Summary

Members Descriptions
public IOHandler(FILE *) Default IOHandler constructor, receiving a file to read
public bool hasNext() Verify if there is next record in the buffer
public void parseNext() Prepare the next parsing element
public void operator>>(Article_t &) Copy the content of the buffer into an article
public int getBiggestId() Parse the next record contained in the buffer

Members

public IOHandler(FILE *)

Default IOHandler constructor, receiving a file to read

public bool hasNext()

Verify if there is next record in the buffer

public void parseNext()

Prepare the next parsing element

public void operator>>(Article_t &)

Copy the content of the buffer into an article

public int getBiggestId()

Parse the next record contained in the buffer

class PrimaryBTree

A class abstracting the btree

Summary

Members Descriptions
public unsigned short rootOffset
public void insert(int key,FILE * indexFile) Insert a key in the tree
public std::pair< bool, int > getArticle(int key,Article_t *,FILE *) Get an article from the tree
public void buildIndex(FILE *) Build the PrimaryBTree index, writing a new root and its offset
public void readRoot(FILE * indexFile) Read the root whence the offset is set
public PrimaryBTree() PrimaryBTree constructor

Members

public unsigned short rootOffset

public void insert(int key,FILE * indexFile)

Insert a key in the tree

public std::pair< bool, int > getArticle(int key,Article_t *,FILE *)

Get an article from the tree

public void buildIndex(FILE *)

Build the PrimaryBTree index, writing a new root and its offset

public void readRoot(FILE * indexFile)

Read the root whence the offset is set

public PrimaryBTree()

PrimaryBTree constructor

class SecondaryBTree

A class abstracting the btree

Summary

Members Descriptions
public int rootOffset
public void insert(SecondaryBTreeDataMap &,FILE * indexFile) Insert a key in the tree
public std::pair< bool, int > getArticle(SecondaryBTreeDataMap & key,Article_t *,FILE *) Get an article from the tree
public void buildIndex(FILE *) Build the PrimaryBTree index, writing a new root and its offset
public void readRoot(FILE * indexFile) Read the root whence the offset is set
public SecondaryBTree() PrimaryBTree constructor

Members

public int rootOffset

public void insert(SecondaryBTreeDataMap &,FILE * indexFile)

Insert a key in the tree

public std::pair< bool, int > getArticle(SecondaryBTreeDataMap & key,Article_t *,FILE *)

Get an article from the tree

public void buildIndex(FILE *)

Build the PrimaryBTree index, writing a new root and its offset

public void readRoot(FILE * indexFile)

Read the root whence the offset is set

PrimaryBTree constructor

struct AbstractBlock_t

Summary

Members Descriptions
public char data

Members

public char data

struct Article_t

A struct to embbed and abstract an article and its fields

Summary

Members Descriptions
public int id
public char title
public int year
public char authors
public int citations
public char date
public char snippet
public std::string toString() Transform the content of this block into a string
public Article_t(int,char,int,char,int,char,char) Constructor including the fields
public Article_t() Default constructor of an Article

Members

public int id

public char title

public int year

public char authors

public int citations

public char date

public char snippet

public std::string toString()

Transform the content of this block into a string

public Article_t(int,char,int,char,int,char,char)

Constructor including the fields

public Article_t()

Default constructor of an Article

struct Block_t

A struct to embbed and abstract an block, its head, data and tail

Summary

Members Descriptions
public BYTE content
public bool tryPutArticle(Article_t &) Try to put the article into the block, return true if it has been successfull
public bool hasSpace() Verify if there is space in the block
public bool isValid() Verify if the block is valid
public void validate() Validate the block before the insertion so the block can be identifyed
public Article_t*getArticle(unsigned int) Get an article in the relative position in the block
public Block_t() Default block constructor

Members

public BYTE content

public bool tryPutArticle(Article_t &)

Try to put the article into the block, return true if it has been successfull

public bool hasSpace()

Verify if there is space in the block

public bool isValid()

Verify if the block is valid

public void validate()

Validate the block before the insertion so the block can be identifyed

public Article_t*getArticle(unsigned int)

Get an article in the relative position in the block

public Block_t()

Default block constructor

struct Header_Interpretation_t::Header

Abstract header representation

Summary

Members Descriptions
public unsigned long verificationMask
public unsigned char count

Members

public unsigned long verificationMask

public unsigned char count

struct PrimaryBTreeNode

A struct used for abstract the concept of node

Summary

Members Descriptions
public unsigned short count
public unsigned short countPointers
public int keys
public unsigned short blockPointers
public PrimaryBTreeNode(int order) PrimaryBTreeNode constructor
public bool isLeaf() Verify if a node is a leaf
public bool hasRoom() Verify if a node has room to insert new nodes
public unsigned short insert(int key) Insert a key in a node and returns the index where the insertion was made.

Members

public unsigned short count

public unsigned short countPointers

public int keys

public unsigned short blockPointers

public PrimaryBTreeNode(int order)

PrimaryBTreeNode constructor

public bool isLeaf()

Verify if a node is a leaf

public bool hasRoom()

Verify if a node has room to insert new nodes

public unsigned short insert(int key)

Insert a key in a node and returns the index where the insertion was made.

struct PrimaryBTreeRecursionResponse

A struct used for save the response of the recursive insertion method

Summary

Members Descriptions
public bool hasBeenSplit
public int promotedKey
public unsigned short newBlockOffset
public PrimaryBTreeRecursionResponse(bool,int,unsigned short) Build a recursion response from the core

Members

public bool hasBeenSplit

public int promotedKey

public unsigned short newBlockOffset

public PrimaryBTreeRecursionResponse(bool,int,unsigned short)

Build a recursion response from the core

struct SecondaryBTreeDataMap

A struct used for abstract the keymap and the data block

Summary

Members Descriptions
public char key
public int dataPointer
public bool operator<(const SecondaryBTreeDataMap & other) const
public bool operator>(const SecondaryBTreeDataMap & other) const
public bool operator==(const SecondaryBTreeDataMap & other) const
public void operator=(const SecondaryBTreeDataMap & other)

Members

public char key

public int dataPointer

public bool operator<(const SecondaryBTreeDataMap & other) const

public bool operator>(const SecondaryBTreeDataMap & other) const

public bool operator==(const SecondaryBTreeDataMap & other) const

public void operator=(const SecondaryBTreeDataMap & other)

struct SecondaryBTreeNode

A struct used for abstract the concept of node

Summary

Members Descriptions
public unsigned short count
public unsigned short countPointers
public SecondaryBTreeDataMap keys
public int blockPointers
public SecondaryBTreeNode(int order) PrimaryBTreeNode constructor
public bool isLeaf() Verify if a node is a leaf
public bool hasRoom() Verify if a node has room to insert new nodes
public int insert(SecondaryBTreeDataMap &) Insert a key in a node and returns the index where the insertion was made.

Members

public unsigned short count

public unsigned short countPointers

public int blockPointers

public SecondaryBTreeNode(int order)

PrimaryBTreeNode constructor

public bool isLeaf()

Verify if a node is a leaf

public bool hasRoom()

Verify if a node has room to insert new nodes

Insert a key in a node and returns the index where the insertion was made.

struct SecondaryBTreeRecursionResponse

A struct used for save the response of the recursive insertion method

Summary

Members Descriptions
public bool hasBeenSplit
public SecondaryBTreeDataMap promotedKey
public int newBlockOffset
public SecondaryBTreeRecursionResponse(bool) Build a recursion response from the core
public SecondaryBTreeRecursionResponse(bool,SecondaryBTreeDataMap &,int) Build a recursion response from the core

Members

public bool hasBeenSplit

public int newBlockOffset

Build a recursion response from the core

Build a recursion response from the core

struct Tail_Interpretation_t::Tail

Abstract tail representation

Summary

Members Descriptions
public unsigned long verificationMask

Members

public unsigned long verificationMask

Generated by Moxygen