xapian-core  2.0.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
HoneyTable Class Reference

#include <honey_table.h>

+ Inheritance diagram for HoneyTable:
+ Collaboration diagram for HoneyTable:

Public Member Functions

 HoneyTable (const char *, const std::string &path_, bool read_only_, bool lazy_=false)
 
 HoneyTable (const char *, int fd, off_t offset_, bool read_only_, bool lazy_=false)
 
 ~HoneyTable ()
 
bool is_writable () const
 
int get_flags () const
 
void create_and_open (int flags_, const Honey::RootInfo &root_info)
 
void open (int flags_, const Honey::RootInfo &root_info, honey_revision_number_t)
 
void close (bool permanent)
 
const std::string & get_path () const
 
void add (std::string_view key, const char *val, size_t val_size, bool compressed=false)
 
void add (std::string_view key, std::string_view val, bool compressed=false)
 
void flush_db ()
 
void cancel (const Honey::RootInfo &, honey_revision_number_t)
 
void commit (honey_revision_number_t, Honey::RootInfo *root_info)
 
bool sync ()
 
bool empty () const
 
bool get_exact_entry (std::string_view key, std::string &tag) const
 
bool key_exists (const std::string &key) const
 
bool del (const std::string &)
 
bool readahead_key (const std::string &) const
 
bool is_modified () const
 
HoneyCursorcursor_get () const
 
bool exists () const
 
bool is_open () const
 
honey_tablesize_t get_entry_count () const
 
honey_tablesize_t get_approx_entry_count () const
 Return an approximation of the number of entries in the table. More...
 
off_t get_root () const
 
off_t get_offset () const
 

Static Public Member Functions

static void throw_database_closed ()
 

Private Member Functions

bool single_file () const
 
bool get_exact_entry (std::string_view key, std::string *tag) const
 
bool read_key (std::string &key, size_t &val_size, bool &compressed) const
 
void read_val (std::string &val, size_t val_size) const
 

Private Attributes

std::string path
 
bool read_only
 
int flags
 
uint4 compress_min
 
BufferedFile store
 
std::string last_key
 
SSTIndex index
 
off_t root = -1
 
honey_tablesize_t num_entries = 0
 
bool lazy
 
off_t offset = 0
 Offset to add to pointers in this table. More...
 

Friends

class HoneyCursor
 
class MutableHoneyCursor
 

Detailed Description

Definition at line 553 of file honey_table.h.

Constructor & Destructor Documentation

◆ HoneyTable() [1/2]

HoneyTable::HoneyTable ( const char *  ,
const std::string &  path_,
bool  read_only_,
bool  lazy_ = false 
)
inline

Definition at line 585 of file honey_table.h.

◆ HoneyTable() [2/2]

HoneyTable::HoneyTable ( const char *  ,
int  fd,
off_t  offset_,
bool  read_only_,
bool  lazy_ = false 
)
inline

Definition at line 593 of file honey_table.h.

◆ ~HoneyTable()

HoneyTable::~HoneyTable ( )
inline

Definition at line 602 of file honey_table.h.

References BufferedFile::close(), index, path, single_file(), SSTIndex::size(), and store.

Member Function Documentation

◆ add() [1/2]

void HoneyTable::add ( std::string_view  key,
const char *  val,
size_t  val_size,
bool  compressed = false 
)

◆ add() [2/2]

void HoneyTable::add ( std::string_view  key,
std::string_view  val,
bool  compressed = false 
)
inline

Definition at line 637 of file honey_table.h.

References add().

◆ cancel()

void HoneyTable::cancel ( const Honey::RootInfo ,
honey_revision_number_t   
)
inline

Definition at line 648 of file honey_table.h.

Referenced by HoneySpellingTable::cancel(), and HoneySynonymTable::cancel().

◆ close()

void HoneyTable::close ( bool  permanent)
inline

Definition at line 622 of file honey_table.h.

References BufferedFile::close(), BufferedFile::force_close(), single_file(), and store.

Referenced by HoneyDatabase::close().

◆ commit()

void HoneyTable::commit ( honey_revision_number_t  ,
Honey::RootInfo root_info 
)

◆ create_and_open()

void HoneyTable::create_and_open ( int  flags_,
const Honey::RootInfo root_info 
)

◆ cursor_get()

HoneyCursor * HoneyTable::cursor_get ( ) const

◆ del()

bool HoneyTable::del ( const std::string &  )
inline

◆ empty()

bool HoneyTable::empty ( ) const
inline

Definition at line 659 of file honey_table.h.

References num_entries.

Referenced by HoneyDatabase::has_positions(), HoneyInverter::has_positions(), and is_modified().

◆ exists()

bool HoneyTable::exists ( ) const
inline

Definition at line 682 of file honey_table.h.

References path.

◆ flush_db()

void HoneyTable::flush_db ( )
inline

◆ get_approx_entry_count()

honey_tablesize_t HoneyTable::get_approx_entry_count ( ) const
inline

Return an approximation of the number of entries in the table.

Currently this is exact, but may not be in the future.

Definition at line 699 of file honey_table.h.

References num_entries.

◆ get_entry_count()

honey_tablesize_t HoneyTable::get_entry_count ( ) const
inline

Definition at line 693 of file honey_table.h.

References num_entries.

Referenced by HoneyInverter::has_positions(), and main().

◆ get_exact_entry() [1/2]

bool HoneyTable::get_exact_entry ( std::string_view  key,
std::string &  tag 
) const
inline

Definition at line 663 of file honey_table.h.

References get_exact_entry().

◆ get_exact_entry() [2/2]

bool HoneyTable::get_exact_entry ( std::string_view  key,
std::string *  tag 
) const
private

◆ get_flags()

int HoneyTable::get_flags ( ) const
inline

Definition at line 615 of file honey_table.h.

References flags.

◆ get_offset()

off_t HoneyTable::get_offset ( ) const
inline

Definition at line 703 of file honey_table.h.

References offset.

◆ get_path()

const std::string& HoneyTable::get_path ( ) const
inline

Definition at line 630 of file honey_table.h.

References path.

Referenced by HoneyDatabase::compact().

◆ get_root()

off_t HoneyTable::get_root ( ) const
inline

Definition at line 701 of file honey_table.h.

References root.

◆ is_modified()

bool HoneyTable::is_modified ( ) const
inline

Definition at line 678 of file honey_table.h.

References empty(), and read_only.

Referenced by HoneySpellingTable::is_modified(), and HoneySynonymTable::is_modified().

◆ is_open()

bool HoneyTable::is_open ( ) const
inline

Definition at line 687 of file honey_table.h.

References BufferedFile::is_open(), and store.

Referenced by HoneyDatabase::open_term_list(), and HoneyDatabase::reopen().

◆ is_writable()

bool HoneyTable::is_writable ( ) const
inline

Definition at line 613 of file honey_table.h.

References read_only.

◆ key_exists()

bool HoneyTable::key_exists ( const std::string &  key) const
inline

Definition at line 667 of file honey_table.h.

References get_exact_entry().

Referenced by HoneyPostListTable::term_exists().

◆ open()

void HoneyTable::open ( int  flags_,
const Honey::RootInfo root_info,
honey_revision_number_t   
)

◆ read_key()

bool HoneyTable::read_key ( std::string &  key,
size_t &  val_size,
bool &  compressed 
) const
private

Definition at line 158 of file honey_table.cc.

References Assert, AssertEq, AssertRel, description_append(), p, and unpack_uint().

◆ read_val()

void HoneyTable::read_val ( std::string &  val,
size_t  val_size 
) const
private

Definition at line 232 of file honey_table.cc.

References AssertRel, and description_append().

◆ readahead_key()

bool HoneyTable::readahead_key ( const std::string &  ) const
inline

Definition at line 676 of file honey_table.h.

Referenced by HoneyDocDataTable::readahead_for_document().

◆ single_file()

bool HoneyTable::single_file ( ) const
inlineprivate

Definition at line 569 of file honey_table.h.

References path.

Referenced by close(), and ~HoneyTable().

◆ sync()

bool HoneyTable::sync ( )
inline

Definition at line 654 of file honey_table.h.

References store, and BufferedFile::sync().

Referenced by HoneyDatabase::compact().

◆ throw_database_closed()

static void HoneyTable::throw_database_closed ( )
inlinestatic

Friends And Related Function Documentation

◆ HoneyCursor

friend class HoneyCursor
friend

Definition at line 555 of file honey_table.h.

◆ MutableHoneyCursor

friend class MutableHoneyCursor
friend

Definition at line 556 of file honey_table.h.

Member Data Documentation

◆ compress_min

uint4 HoneyTable::compress_min
private

Definition at line 561 of file honey_table.h.

◆ flags

int HoneyTable::flags
private

Definition at line 560 of file honey_table.h.

Referenced by get_flags().

◆ index

SSTIndex HoneyTable::index
private

Definition at line 564 of file honey_table.h.

Referenced by flush_db(), and ~HoneyTable().

◆ last_key

std::string HoneyTable::last_key
mutableprivate

Definition at line 563 of file honey_table.h.

◆ lazy

bool HoneyTable::lazy
private

Definition at line 567 of file honey_table.h.

◆ num_entries

honey_tablesize_t HoneyTable::num_entries = 0
private

Definition at line 566 of file honey_table.h.

Referenced by empty(), get_approx_entry_count(), and get_entry_count().

◆ offset

off_t HoneyTable::offset = 0
private

Offset to add to pointers in this table.

This is zero when each table is a separate file, but likely non-zero when the tables are all embedded in one file.

Definition at line 576 of file honey_table.h.

Referenced by get_offset().

◆ path

std::string HoneyTable::path
private

Definition at line 558 of file honey_table.h.

Referenced by exists(), get_path(), single_file(), and ~HoneyTable().

◆ read_only

bool HoneyTable::read_only
private

Definition at line 559 of file honey_table.h.

Referenced by is_modified(), and is_writable().

◆ root

off_t HoneyTable::root = -1
private

Definition at line 565 of file honey_table.h.

Referenced by flush_db(), and get_root().

◆ store

BufferedFile HoneyTable::store
mutableprivate

Definition at line 562 of file honey_table.h.

Referenced by close(), flush_db(), is_open(), sync(), and ~HoneyTable().


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