ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
meta::index::chunk< PrimaryKey, SecondaryKey > Class Template Reference

Represents a portion of a disk_index's postings file. More...

#include <chunk.h>

Public Member Functions

 chunk (const std::string &path)
 
bool operator< (const chunk &other) const
 
uint64_t size () const
 
std::string path () const
 
void merge_with (const chunk &other)
 After this function ends, the current chunk file will contain information from both chunks, and the "other" chunk file will be deleted. More...
 
template<class Container >
void memory_merge_with (Container &pdata)
 

Private Member Functions

void set_size ()
 Calculates the size of the file this chunk represents in bytes.
 

Private Attributes

std::string path_
 The path to this chunk file on disk.
 
uint64_t size_
 The number of bytes this chunk takes up.
 

Detailed Description

template<class PrimaryKey, class SecondaryKey>
class meta::index::chunk< PrimaryKey, SecondaryKey >

Represents a portion of a disk_index's postings file.

It is an intermediate file mapping primary keys to secondary keys. The chunks are sorted to enable efficient merging, and define an operator< to allow them to be sorted or stored in a priority queue.

Constructor & Destructor Documentation

template<class PrimaryKey , class SecondaryKey >
meta::index::chunk< PrimaryKey, SecondaryKey >::chunk ( const std::string &  path)
Parameters
pathThe path to this chunk file on disk

Member Function Documentation

template<class PrimaryKey , class SecondaryKey >
bool meta::index::chunk< PrimaryKey, SecondaryKey >::operator< ( const chunk< PrimaryKey, SecondaryKey > &  other) const
Parameters
otherThe other chunk to compare with this one
Returns
whether this chunk is less than (has a smaller size than) the parameter
template<class PrimaryKey , class SecondaryKey >
uint64_t meta::index::chunk< PrimaryKey, SecondaryKey >::size ( ) const
Returns
the size of this postings file chunk in bytes
template<class PrimaryKey , class SecondaryKey >
std::string meta::index::chunk< PrimaryKey, SecondaryKey >::path ( ) const
Returns
the path to this chunk
template<class PrimaryKey , class SecondaryKey >
void meta::index::chunk< PrimaryKey, SecondaryKey >::merge_with ( const chunk< PrimaryKey, SecondaryKey > &  other)

After this function ends, the current chunk file will contain information from both chunks, and the "other" chunk file will be deleted.

Parameters
otherThe other chunk to merge merge_with
template<class PrimaryKey , class SecondaryKey >
template<class Container >
void meta::index::chunk< PrimaryKey, SecondaryKey >::memory_merge_with ( Container &  pdata)
Parameters
pdataA collection of postings data to combine with this chunk pdata must:
  • support iteration in sorted order
  • dereferenced type must be a postings_data<PrimaryKey, SecondaryKey> object
  • implement the clear() function

The documentation for this class was generated from the following files: