#include <StorageBuilder.hpp>
Public Types | |
typedef std::pair< uint16_t, uint32_t > | Location |
Public Member Functions | |
StorageBuilder () | |
~StorageBuilder () | |
bool | is_open () const |
const bfs::path & | directory () const |
void | close () throw (std::invalid_argument) |
void | open (const bfs::path &directory) throw (std::invalid_argument) |
void | put (const std::string &key, Iterator::SharedPointer iterator) throw (std::runtime_error) |
void | put (const std::string &key, const Quantile &quantile) throw (std::runtime_error) |
const Vocabulary & | vocabulary () const |
Static Public Attributes | |
static const std::string | data_file |
static const std::string | mphf_file |
static const std::string | vocab_file |
static const std::string | storage_file |
static const std::string | quantile_file |
static const size_t | max_file_size = 1024 * 1024 * 1024 |
Private Types | |
typedef PostlistWriter::SharedPointer | Writer |
typedef std::tr1::unordered_map < std::string, Location > | LocationMap |
typedef std::tr1::unordered_map < std::string, Quantile > | QuantileMap |
typedef std::vector< Writer > | WriterVector |
Private Attributes | |
bfs::path | directory_ |
Vocabulary | vocabulary_ |
LocationMap | locations_ |
QuantileMap | quantiles_ |
WriterVector | writers_ |
A class to write postlists to an external storage device.
Created on Jun 22, 2008
Definition at line 27 of file StorageBuilder.hpp.
typedef std::pair<uint16_t, uint32_t> aitools::invertedindex::StorageBuilder::Location |
Defines a pair of file id and file offset.
Definition at line 34 of file StorageBuilder.hpp.
typedef std::tr1::unordered_map<std::string, Location> aitools::invertedindex::StorageBuilder::LocationMap [private] |
Definition at line 39 of file StorageBuilder.hpp.
typedef std::tr1::unordered_map<std::string, Quantile> aitools::invertedindex::StorageBuilder::QuantileMap [private] |
Definition at line 40 of file StorageBuilder.hpp.
typedef PostlistWriter::SharedPointer aitools::invertedindex::StorageBuilder::Writer [private] |
Definition at line 38 of file StorageBuilder.hpp.
typedef std::vector<Writer> aitools::invertedindex::StorageBuilder::WriterVector [private] |
Definition at line 41 of file StorageBuilder.hpp.
aitools::invertedindex::StorageBuilder::StorageBuilder | ( | ) |
Definition at line 25 of file StorageBuilder.cpp.
aitools::invertedindex::StorageBuilder::~StorageBuilder | ( | ) |
Definition at line 28 of file StorageBuilder.cpp.
References close().
void aitools::invertedindex::StorageBuilder::close | ( | ) | throw (std::invalid_argument) |
Definition at line 46 of file StorageBuilder.cpp.
References aitools::invertedindex::MPHashFunction::create(), directory_, aitools::util::fclose(), aitools::invertedindex::System::fopen(), aitools::util::fwrite(), aitools::invertedindex::MPHashFunction::hash(), is_open(), locations_, mphf_file, quantile_file, quantiles_, aitools::invertedindex::Vocabulary::save(), aitools::invertedindex::MPHashFunction::save(), aitools::invertedindex::Quantile::size, aitools::invertedindex::MPHashFunction::size(), storage_file, vocab_file, vocabulary_, and writers_.
Referenced by ~StorageBuilder().
const bfs::path & aitools::invertedindex::StorageBuilder::directory | ( | ) | const |
Definition at line 40 of file StorageBuilder.cpp.
References directory_.
bool aitools::invertedindex::StorageBuilder::is_open | ( | ) | const |
Definition at line 34 of file StorageBuilder.cpp.
References directory_.
Referenced by close().
void aitools::invertedindex::StorageBuilder::open | ( | const bfs::path & | directory | ) | throw (std::invalid_argument) |
Definition at line 86 of file StorageBuilder.cpp.
References aitools::invertedindex::Exception::throw_invalid_argument().
void aitools::invertedindex::StorageBuilder::put | ( | const std::string & | key, | |
const Quantile & | quantile | |||
) | throw (std::runtime_error) |
Definition at line 129 of file StorageBuilder.cpp.
References aitools::invertedindex::Exception::throw_runtime_error().
void aitools::invertedindex::StorageBuilder::put | ( | const std::string & | key, | |
Iterator::SharedPointer | iterator | |||
) | throw (std::runtime_error) |
Definition at line 97 of file StorageBuilder.cpp.
References aitools::invertedindex::Logging::log(), aitools::invertedindex::Exception::throw_runtime_error(), and aitools::invertedindex::Converter::ui32_to_str().
const Vocabulary & aitools::invertedindex::StorageBuilder::vocabulary | ( | ) | const |
Definition at line 144 of file StorageBuilder.cpp.
References vocabulary_.
const std::string aitools::invertedindex::StorageBuilder::data_file [static] |
Definition at line 45 of file StorageBuilder.hpp.
Referenced by aitools::invertedindex::StorageSearcher::open().
bfs::path aitools::invertedindex::StorageBuilder::directory_ [private] |
Definition at line 79 of file StorageBuilder.hpp.
Referenced by close(), directory(), and is_open().
Definition at line 81 of file StorageBuilder.hpp.
Referenced by close().
const size_t aitools::invertedindex::StorageBuilder::max_file_size = 1024 * 1024 * 1024 [static] |
Definition at line 51 of file StorageBuilder.hpp.
const std::string aitools::invertedindex::StorageBuilder::mphf_file [static] |
Definition at line 46 of file StorageBuilder.hpp.
Referenced by close(), and aitools::invertedindex::StorageSearcher::open().
const std::string aitools::invertedindex::StorageBuilder::quantile_file [static] |
Definition at line 49 of file StorageBuilder.hpp.
Referenced by close(), and aitools::invertedindex::StorageSearcher::open().
Definition at line 82 of file StorageBuilder.hpp.
Referenced by close().
const std::string aitools::invertedindex::StorageBuilder::storage_file [static] |
Definition at line 48 of file StorageBuilder.hpp.
Referenced by close(), and aitools::invertedindex::StorageSearcher::open().
const std::string aitools::invertedindex::StorageBuilder::vocab_file [static] |
Definition at line 47 of file StorageBuilder.hpp.
Referenced by close(), and aitools::invertedindex::StorageSearcher::open().
Definition at line 80 of file StorageBuilder.hpp.
Referenced by close(), and vocabulary().
Definition at line 83 of file StorageBuilder.hpp.
Referenced by close().