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

#include <honey_cursor.h>

+ Inheritance diagram for HoneyCursor:
+ Collaboration diagram for HoneyCursor:

Public Member Functions

 HoneyCursor (const HoneyTable *table)
 
 HoneyCursor (const HoneyCursor &o)
 
void rewind ()
 Position cursor on the dummy empty key. More...
 
void to_end ()
 
bool after_end () const
 
bool next ()
 
bool read_tag (bool keep_compressed=false)
 
bool find_exact (std::string_view key)
 
bool find_entry_ge (std::string_view key)
 
bool prev ()
 Move to the item before the current one. More...
 

Public Attributes

std::string current_key
 
std::string current_tag
 
size_t val_size = 0
 
bool current_compressed = false
 
CompressionStream comp_stream
 
bool is_at_end = false
 
std::string last_key
 
off_t root
 
off_t offset
 

Private Member Functions

bool do_find (std::string_view key, bool greater_than)
 Search for key. More...
 
bool do_next ()
 
bool next_from_index ()
 Handle the value part of the (key,value). More...
 

Private Attributes

BufferedFile store
 

Detailed Description

Definition at line 26 of file honey_cursor.h.

Constructor & Destructor Documentation

◆ HoneyCursor() [1/2]

HoneyCursor::HoneyCursor ( const HoneyTable table)
inlineexplicit

Definition at line 57 of file honey_cursor.h.

References offset, BufferedFile::set_pos(), and store.

◆ HoneyCursor() [2/2]

HoneyCursor::HoneyCursor ( const HoneyCursor o)
inline

Definition at line 66 of file honey_cursor.h.

References BufferedFile::get_pos(), BufferedFile::set_pos(), and store.

Member Function Documentation

◆ after_end()

bool HoneyCursor::after_end ( ) const
inline

◆ do_find()

bool HoneyCursor::do_find ( std::string_view  key,
bool  greater_than 
)
private

Search for key.

If key isn't present, the behaviour depends on greater_than. If it's true, then the cursor will be left on the first key > key; otherwise it may be left at an unspecified position.

Definition at line 170 of file honey_cursor.cc.

References Assert, description_append(), p, SSTINDEX_BINARY_CHOP_ENTRY_SIZE, SSTINDEX_BINARY_CHOP_KEY_SIZE, Xapian::Internal::str(), HoneyTable::throw_database_closed(), and unpack_uint().

Referenced by find_entry_ge(), and find_exact().

◆ do_next()

bool HoneyCursor::do_next ( )
private

Definition at line 37 of file honey_cursor.cc.

References Assert, AssertEq, and description_append().

Referenced by next().

◆ find_entry_ge()

bool HoneyCursor::find_entry_ge ( std::string_view  key)
inline

◆ find_exact()

bool HoneyCursor::find_exact ( std::string_view  key)
inline

Definition at line 106 of file honey_cursor.h.

References do_find().

◆ next()

bool HoneyCursor::next ( )
inline

◆ next_from_index()

bool HoneyCursor::next_from_index ( )
private

Handle the value part of the (key,value).

Definition at line 90 of file honey_cursor.cc.

References p, and unpack_uint().

◆ prev()

bool HoneyCursor::prev ( )

Move to the item before the current one.

If the cursor is after_end(), this moves to the last item.

If the cursor is at the start of the table (on the empty key), do nothing and return false, otherwise return true.

This method may not be particularly efficient.

Definition at line 387 of file honey_cursor.cc.

References HONEY_MAX_KEY_LENGTH, pos, and HoneyTable::throw_database_closed().

Referenced by main().

◆ read_tag()

bool HoneyCursor::read_tag ( bool  keep_compressed = false)

◆ rewind()

void HoneyCursor::rewind ( )
inline

Position cursor on the dummy empty key.

Calling next() after this moves the cursor to the first entry.

Definition at line 85 of file honey_cursor.h.

References current_key, is_at_end, last_key, offset, BufferedFile::set_pos(), store, and val_size.

Referenced by main(), and HoneyCompact::merge_docid_keyed().

◆ to_end()

void HoneyCursor::to_end ( )
inline

Member Data Documentation

◆ comp_stream

CompressionStream HoneyCursor::comp_stream
mutable

Definition at line 46 of file honey_cursor.h.

◆ current_compressed

bool HoneyCursor::current_compressed = false

Definition at line 45 of file honey_cursor.h.

◆ current_key

std::string HoneyCursor::current_key

◆ current_tag

std::string HoneyCursor::current_tag

◆ is_at_end

bool HoneyCursor::is_at_end = false

Definition at line 47 of file honey_cursor.h.

Referenced by after_end(), MutableHoneyCursor::del(), rewind(), and to_end().

◆ last_key

std::string HoneyCursor::last_key
mutable

Definition at line 48 of file honey_cursor.h.

Referenced by rewind().

◆ offset

off_t HoneyCursor::offset

Definition at line 54 of file honey_cursor.h.

Referenced by HoneyCursor(), and rewind().

◆ root

off_t HoneyCursor::root

Definition at line 51 of file honey_cursor.h.

◆ store

BufferedFile HoneyCursor::store
private

Definition at line 40 of file honey_cursor.h.

Referenced by HoneyCursor(), next(), and rewind().

◆ val_size

size_t HoneyCursor::val_size = 0
mutable

Definition at line 44 of file honey_cursor.h.

Referenced by rewind().


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