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

#include <honey_synonym.h>

+ Inheritance diagram for HoneySynonymTable:
+ Collaboration diagram for HoneySynonymTable:

Public Member Functions

 HoneySynonymTable (const std::string &dbdir, bool readonly)
 Create a new HoneySynonymTable object. More...
 
 HoneySynonymTable (int fd, off_t offset_, bool readonly)
 
void merge_changes ()
 
void discard_changes ()
 
void add_synonym (std::string_view term, std::string_view synonym)
 Add a synonym for term. More...
 
void remove_synonym (std::string_view term, std::string_view synonym)
 Remove a synonym for term. More...
 
void clear_synonyms (std::string_view term)
 Remove all synonyms for term. More...
 
TermListopen_termlist (std::string_view term) const
 Open synonym termlist for a term. More...
 
bool is_modified () const
 Override methods of HoneyTable. More...
 
void flush_db ()
 Override methods of HoneyTable. More...
 
void cancel (const Honey::RootInfo &root_info, honey_revision_number_t rev)
 Override methods of HoneyTable. More...
 
- Public Member Functions inherited from HoneyLazyTable
 HoneyLazyTable (const char *name_, const std::string &path_, bool readonly)
 Create a new lazy table. More...
 
 HoneyLazyTable (const char *name_, int fd, off_t offset_, bool readonly)
 
- Public Member Functions inherited from HoneyTable
 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
 

Private Attributes

std::string last_term
 The last term which was updated. More...
 
std::set< std::string, std::less<> > last_synonyms
 The synonyms for the last term which was updated. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from HoneyTable
static void throw_database_closed ()
 

Detailed Description

Definition at line 42 of file honey_synonym.h.

Constructor & Destructor Documentation

◆ HoneySynonymTable() [1/2]

HoneySynonymTable::HoneySynonymTable ( const std::string &  dbdir,
bool  readonly 
)
inline

Create a new HoneySynonymTable object.

This method does not create or open the table on disk - you must call the create() or open() methods respectively!

Parameters
dbdirThe directory the honey database is stored in.
readonlytrue if we're opening read-only, else false.

Definition at line 58 of file honey_synonym.h.

◆ HoneySynonymTable() [2/2]

HoneySynonymTable::HoneySynonymTable ( int  fd,
off_t  offset_,
bool  readonly 
)
inline

Definition at line 61 of file honey_synonym.h.

Member Function Documentation

◆ add_synonym()

void HoneySynonymTable::add_synonym ( std::string_view  term,
std::string_view  synonym 
)

Add a synonym for term.

If the synonym has already been added, no action is taken.

Definition at line 66 of file honey_synonym.cc.

References MAGIC_XOR_VALUE, p, and term.

◆ cancel()

void HoneySynonymTable::cancel ( const Honey::RootInfo root_info,
honey_revision_number_t  rev 
)
inline

Override methods of HoneyTable.

NB: these aren't virtual, but we always call them on the subclass in cases where it matters.

Definition at line 113 of file honey_synonym.h.

References HoneyTable::cancel(), and discard_changes().

◆ clear_synonyms()

void HoneySynonymTable::clear_synonyms ( std::string_view  term)

Remove all synonyms for term.

If term has no synonyms, no action is taken.

Definition at line 122 of file honey_synonym.cc.

References term.

◆ discard_changes()

void HoneySynonymTable::discard_changes ( )
inline

Definition at line 68 of file honey_synonym.h.

References last_synonyms, and last_term.

Referenced by cancel().

◆ flush_db()

void HoneySynonymTable::flush_db ( )
inline

Override methods of HoneyTable.

NB: these aren't virtual, but we always call them on the subclass in cases where it matters.

Definition at line 108 of file honey_synonym.h.

References HoneyTable::flush_db(), and merge_changes().

◆ is_modified()

bool HoneySynonymTable::is_modified ( ) const
inline

Override methods of HoneyTable.

NB: these aren't virtual, but we always call them on the subclass in cases where it matters.

Definition at line 104 of file honey_synonym.h.

References HoneyTable::is_modified(), and last_term.

◆ merge_changes()

void HoneySynonymTable::merge_changes ( )

Definition at line 45 of file honey_synonym.cc.

References MAGIC_XOR_VALUE.

Referenced by flush_db().

◆ open_termlist()

TermList * HoneySynonymTable::open_termlist ( std::string_view  term) const

Open synonym termlist for a term.

If term has no synonyms, NULL is returned.

Definition at line 138 of file honey_synonym.cc.

References MAGIC_XOR_VALUE, p, and term.

Referenced by HoneyDatabase::open_synonym_termlist().

◆ remove_synonym()

void HoneySynonymTable::remove_synonym ( std::string_view  term,
std::string_view  synonym 
)

Remove a synonym for term.

If the synonym doesn't exist, no action is taken.

Definition at line 92 of file honey_synonym.cc.

References MAGIC_XOR_VALUE, p, and term.

Member Data Documentation

◆ last_synonyms

std::set<std::string, std::less<> > HoneySynonymTable::last_synonyms
mutableprivate

The synonyms for the last term which was updated.

Definition at line 47 of file honey_synonym.h.

Referenced by discard_changes().

◆ last_term

std::string HoneySynonymTable::last_term
mutableprivate

The last term which was updated.

Definition at line 44 of file honey_synonym.h.

Referenced by discard_changes(), and is_modified().


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