|
xapian-core
2.0.0
|
Implementation of RemoteDatabase using a spawned server. More...
#include <progclient.h>
Inheritance diagram for ProgClient:
Collaboration diagram for ProgClient:Public Member Functions | |
| ProgClient (std::string_view progname, std::string_view args, double timeout_, bool writable, int flags) | |
| Constructor. More... | |
| ~ProgClient () | |
| Destructor. More... | |
Public Member Functions inherited from RemoteDatabase | |
| Xapian::termcount | positionlist_count (Xapian::docid did, std::string_view term) const |
| Get the length of the position list. More... | |
| void | keep_alive () |
| Send a keep-alive message. More... | |
| void | set_query (const Xapian::Query &query, Xapian::termcount qlen, Xapian::valueno collapse_key, Xapian::doccount collapse_max, Xapian::Enquire::docid_order order, Xapian::valueno sort_key, Xapian::Enquire::Internal::sort_setting sort_by, bool sort_value_forward, double time_limit, int percent_threshold, double weight_threshold, const Xapian::Weight &wtscheme, const Xapian::RSet &omrset, const std::vector< opt_ptr_spy > &matchspies) const |
| Set the query. More... | |
| int | get_read_fd () const |
| Get the underlying fd this remote connection reads from. More... | |
| void | accumulate_remote_stats (Xapian::Weight::Internal &total) const |
| Accumulate stats from the remote server. More... | |
| void | send_global_stats (Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount check_at_least, const Xapian::KeyMaker *sorter, const Xapian::Weight::Internal &stats) const |
| Send the global stats to the remote server. More... | |
| Xapian::MSet | get_mset (const std::vector< opt_ptr_spy > &matchspies) const |
| Get the MSet from the remote server. More... | |
| TermList * | open_metadata_keylist (std::string_view prefix) const |
| Get remote metadata key list. More... | |
| TermList * | open_term_list (Xapian::docid did) const |
| Get remote termlist. More... | |
| TermList * | open_term_list_direct (Xapian::docid did) const |
| Like open_term_list() but without MultiTermList wrapper. More... | |
| TermList * | open_allterms (std::string_view prefix) const |
| Iterate all terms. More... | |
| bool | has_positions () const |
| Check whether this database contains any positional information. More... | |
| bool | reopen () |
| Reopen the database to the latest available revision. More... | |
| void | close () |
| Close the database. More... | |
| PostList * | open_post_list (std::string_view term) const |
| Return a PostList suitable for use in a PostingIterator. More... | |
| LeafPostList * | open_leaf_post_list (std::string_view term, bool) const |
| Create a LeafPostList for use during a match. More... | |
| Xapian::doccount | read_post_list (const std::string &term, NetworkPostList &pl) const |
| PositionList * | open_position_list (Xapian::docid did, std::string_view tname) const |
| Xapian::Document::Internal * | open_document (Xapian::docid did, bool lazy) const |
| Get a remote document. More... | |
| Xapian::doccount | get_doccount () const |
| Get the document count. More... | |
| Xapian::docid | get_lastdocid () const |
| Get the last used docid. More... | |
| Xapian::totallength | get_total_length () const |
| Return the total length of all documents in this database. More... | |
| Xapian::termcount | get_doclength (Xapian::docid did) const |
| Xapian::termcount | get_unique_terms (Xapian::docid did) const |
| Get the number of unique terms in document. More... | |
| Xapian::termcount | get_wdfdocmax (Xapian::docid did) const |
| Get the max wdf in document. More... | |
| bool | term_exists (std::string_view term) const |
| Check if term exists. More... | |
| void | get_freqs (std::string_view term, Xapian::doccount *termfreq_ptr, Xapian::termcount *collfreq_ptr) const |
| Returns frequencies for a term. More... | |
| void | read_value_stats (Xapian::valueno slot) const |
| Read the value statistics for a value from a remote database. More... | |
| Xapian::doccount | get_value_freq (Xapian::valueno slot) const |
| Return the frequency of a given value slot. More... | |
| std::string | get_value_lower_bound (Xapian::valueno slot) const |
| Get a lower bound on the values stored in the given value slot. More... | |
| std::string | get_value_upper_bound (Xapian::valueno slot) const |
| Get an upper bound on the values stored in the given value slot. More... | |
| Xapian::termcount | get_doclength_lower_bound () const |
| Get a lower bound on the length of a document in this DB. More... | |
| Xapian::termcount | get_doclength_upper_bound () const |
| Get an upper bound on the length of a document in this DB. More... | |
| Xapian::termcount | get_wdf_upper_bound (std::string_view term) const |
| Get an upper bound on the wdf of term term. More... | |
| void | commit () |
| Commit pending modifications to the database. More... | |
| void | cancel () |
| Cancel pending modifications to the database. More... | |
| Xapian::docid | add_document (const Xapian::Document &doc) |
| void | delete_document (Xapian::docid did) |
| void | delete_document (std::string_view unique_term) |
| Delete any documents indexed by a term from the database. More... | |
| void | replace_document (Xapian::docid did, const Xapian::Document &doc) |
| Xapian::docid | replace_document (std::string_view unique_term, const Xapian::Document &document) |
| Replace any documents matching a term. More... | |
| std::string | get_uuid () const |
| Get a UUID for the database. More... | |
| std::string | get_metadata (std::string_view key) const |
| Get the metadata associated with a given key. More... | |
| void | set_metadata (std::string_view key, std::string_view value) |
| Set the metadata associated with a given key. More... | |
| void | request_document (Xapian::docid did) const |
| Request a document. More... | |
| void | add_spelling (std::string_view word, Xapian::termcount freqinc) const |
| Add a word to the spelling dictionary. More... | |
| TermList * | open_synonym_termlist (std::string_view term) const |
| Open a termlist returning synonyms for a term. More... | |
| TermList * | open_synonym_keylist (std::string_view prefix) const |
| Open a termlist returning each term which has synonyms. More... | |
| void | add_synonym (std::string_view word, std::string_view synonym) const |
| Add a synonym for a term. More... | |
| void | remove_synonym (std::string_view word, std::string_view synonym) const |
| Remove a synonym for a term. More... | |
| void | clear_synonyms (std::string_view word) const |
| Clear all synonyms for a term. More... | |
| Xapian::termcount | remove_spelling (std::string_view word, Xapian::termcount freqdec) const |
| Remove a word from the spelling dictionary. More... | |
| int | get_backend_info (std::string *path) const |
| Get backend information about this database. More... | |
| bool | locked () const |
| Return true if the database is open for writing. More... | |
| std::string | reconstruct_text (Xapian::docid did, size_t length, std::string_view prefix, Xapian::termpos start_pos, Xapian::termpos end_pos) const |
| std::string | get_description () const |
| Return a string describing this object. More... | |
Public Member Functions inherited from Xapian::Database::Internal | |
| virtual | ~Internal () |
| We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor. More... | |
| virtual size_type | size () const |
| virtual void | readahead_for_query (const Query &query) const |
| virtual termcount | get_unique_terms_lower_bound () const |
| Get a lower bound on the unique terms size of a document in this DB. More... | |
| virtual termcount | get_unique_terms_upper_bound () const |
| Get an upper bound on the unique terms size of a document in this DB. More... | |
| virtual ValueList * | open_value_list (valueno slot) const |
| Open a value stream. More... | |
| virtual TermList * | open_spelling_termlist (std::string_view word) const |
| Create a termlist tree from trigrams of word. More... | |
| virtual TermList * | open_spelling_wordlist () const |
| Return a termlist which returns the words which are spelling correction targets. More... | |
| virtual doccount | get_spelling_frequency (std::string_view word) const |
| Return the number of times word was added as a spelling. More... | |
| virtual void | begin_transaction (bool flushed) |
| Begin transaction. More... | |
| virtual void | end_transaction (bool do_commit) |
| End transaction. More... | |
| virtual void | write_changesets_to_fd (int fd, std::string_view start_revision, bool need_whole_db, ReplicationInfo *info) |
| Write a set of changesets to a file descriptor. More... | |
| virtual Xapian::rev | get_revision () const |
| Get revision number of database (if meaningful). More... | |
| virtual void | invalidate_doc_object (Document::Internal *obj) const |
| Notify the database that document is no longer valid. More... | |
| virtual void | get_used_docid_range (docid &first, docid &last) const |
| Find lowest and highest docids actually in use. More... | |
| virtual Internal * | update_lock (int flags) |
| Lock a read-only database for writing or unlock a writable database. More... | |
Public Member Functions inherited from Xapian::Internal::intrusive_base | |
| intrusive_base () | |
| Construct with no references. More... | |
Private Member Functions | |
| ProgClient & | operator= (const ProgClient &)=delete |
| Don't allow assignment. More... | |
| ProgClient (const ProgClient &)=delete | |
| Don't allow copying. More... | |
Static Private Member Functions | |
| static std::pair< int, std::string > | run_program (std::string_view progname, std::string_view args, pid_t &child) |
| Start the child process. More... | |
Private Attributes | |
| pid_t | child |
| Process id of the child process. More... | |
Additional Inherited Members | |
Public Types inherited from RemoteDatabase | |
| typedef Xapian::Internal::opt_intrusive_ptr< Xapian::MatchSpy > | opt_ptr_spy |
Public Types inherited from Xapian::Database::Internal | |
| typedef Xapian::doccount | size_type |
Public Attributes inherited from Xapian::Internal::intrusive_base | |
| unsigned | _refs |
| Reference count. More... | |
Protected Types inherited from Xapian::Database::Internal | |
| enum | transaction_state { TRANSACTION_READONLY = -2 , TRANSACTION_UNIMPLEMENTED = -1 , TRANSACTION_NONE = 0 , TRANSACTION_UNFLUSHED = 1 , TRANSACTION_FLUSHED = 2 } |
| Transaction state enum. More... | |
Protected Member Functions inherited from RemoteDatabase | |
| RemoteDatabase (std::pair< int, std::string > fd_and_context, double timeout_, bool writable, int flags) | |
| Constructor. More... | |
| reply_type | get_message (std::string &message, reply_type required_type, reply_type required_type2) const |
| Receive a message from the server. More... | |
| void | get_message (std::string &message, reply_type required_type) const |
| bool | get_message_or_done (std::string &message, reply_type required_type) const |
| void | send_message (message_type type, std::string_view data) const |
| Send a message to the server. More... | |
| void | do_close () |
| Close the socket. More... | |
| bool | get_posting (Xapian::docid &did, double &w, std::string &value) |
Protected Member Functions inherited from Xapian::Database::Internal | |
| Internal (transaction_state transaction_support) | |
| Only constructable as a base class for derived classes. More... | |
| bool | is_read_only () const |
| Test if this shard is read-only. More... | |
| bool | transaction_active () const |
| Test if a transaction is currently active. More... | |
| void | dtor_called () |
| Helper to process uncommitted changes when a writable db is destroyed. More... | |
Protected Attributes inherited from RemoteDatabase | |
| double | timeout |
| The timeout value used in network communications, in seconds. More... | |
Protected Attributes inherited from Xapian::Database::Internal | |
| transaction_state | state |
| Current transaction state. More... | |
Implementation of RemoteDatabase using a spawned server.
ProgClient spawns a child process to connect to the server - for example, an ssh command to run the server on a remote host. Communication with the child process is via a pipe.
Definition at line 37 of file progclient.h.
|
privatedelete |
Don't allow copying.
|
inline |
Constructor.
| progname | The program used to create the connection. |
| args | Any arguments to the program. |
| timeout_ | Timeout for communication (in seconds). |
| writable | Is this a WritableDatabase? |
| flags | Xapian::DB_RETRY_LOCK or 0. |
Definition at line 85 of file progclient.h.
| ProgClient::~ProgClient | ( | ) |
Destructor.
Definition at line 248 of file progclient.cc.
|
privatedelete |
Don't allow assignment.
|
staticprivate |
Start the child process.
| progname | The program used to create the connection. |
| args | Any arguments to the program. |
| child | Reference to store the child process pid/HANDLE in. |
Note: this method is called early on during class construction before any member variables or even the base class have been initialised. To help avoid accidentally trying to use member variables, this method has been deliberately made "static".
Definition at line 51 of file progclient.cc.
References close(), Xapian::Internal::closefrom(), LOGCALL_STATIC, O_BINARY, Xapian::Remote::open(), rare, RETURN, and SOCK_CLOEXEC.
|
private |
Process id of the child process.
Definition at line 46 of file progclient.h.