[honey] Fix portability to systems without pread()
[xapian.git] / xapian-core / net / remoteprotocol.h
blobe7ffd610253f74cb7b730072bbaad8b1bac547dd
1 /** @file remoteprotocol.h
2 * @brief Remote protocol version and message numbers
3 */
4 /* Copyright (C) 2006,2007,2008,2009,2010,2011,2013,2014,2015,2017 Olly Betts
5 * Copyright (C) 2007,2010 Lemur Consulting Ltd
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef XAPIAN_INCLUDED_REMOTEPROTOCOL_H
23 #define XAPIAN_INCLUDED_REMOTEPROTOCOL_H
25 // Versions:
26 // 21: Overhauled remote backend supporting WritableDatabase
27 // 22: Lossless double serialisation
28 // 23: Support get_lastdocid() on remote databases
29 // 24: Support for OP_VALUE_RANGE in query serialisation
30 // 25: Support for delete_document and replace_document with unique term
31 // 26: Tweak delete_document with unique term; delta encode rset and termpos
32 // 27: Support for postlists (always passes the whole list across)
33 // 28: Pass document length in reply to MSG_TERMLIST
34 // 29: Serialisation of Xapian::Error includes error_string
35 // 30: Add minor protocol version numbers, to reduce need for client upgrades
36 // 30.1: Pass the prefix parameter for MSG_ALLTERMS, and use it.
37 // 30.2: New REPLY_DELETEDOCUMENT returns MSG_DONE to allow exceptions.
38 // 30.3: New MSG_GETMSET which passes check_at_least parameter.
39 // 30.4: New query operator OP_SCALE_WEIGHT.
40 // 30.5: New MSG_GETMSET which expects MSet's percent_factor to be returned.
41 // 30.6: Support for OP_VALUE_GE and OP_VALUE_LE in query serialisation
42 // 31: 1.1.0 Clean up for Xapian 1.1.0
43 // 32: 1.1.1 Serialise termfreq and reltermfreqs together in serialise_stats.
44 // 33: 1.1.3 Support for passing matchspies over the remote connection.
45 // 34: 1.1.4 Support for metadata over with remote databases.
46 // 35: 1.1.5 Support for add_spelling() and remove_spelling().
47 // 35.1: 1.2.4 Support for metadata_keys_begin().
48 // 36: 1.3.0 REPLY_UPDATE and REPLY_GREETING merged, and more...
49 // 37: 1.3.1 Prefix-compress termlists.
50 // 38: 1.3.2 Stats serialisation now includes collection freq, and more...
51 // 39: 1.3.3 New query operator OP_WILDCARD; sort keys in serialised MSet.
52 // 39.1: pre-1.5.0 MSG_POSITIONLISTCOUNT added.
53 // 40: 1.5.0 REPLY_REMOVESPELLING added.
54 #define XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION 40
55 #define XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION 0
57 /** Message types (client -> server).
59 * When modifying this list, you probably need to update the switch statement
60 * in net/remoteserver.cc too.
62 enum message_type {
63 MSG_ALLTERMS, // All Terms
64 MSG_COLLFREQ, // Get Collection Frequency
65 MSG_DOCUMENT, // Get Document
66 MSG_TERMEXISTS, // Term Exists?
67 MSG_TERMFREQ, // Get Term Frequency
68 MSG_VALUESTATS, // Get value statistics
69 MSG_KEEPALIVE, // Keep-alive
70 MSG_DOCLENGTH, // Get Doc Length
71 MSG_QUERY, // Run Query
72 MSG_TERMLIST, // Get TermList
73 MSG_POSITIONLIST, // Get PositionList
74 MSG_POSTLIST, // Get PostList
75 MSG_REOPEN, // Reopen
76 MSG_UPDATE, // Get Updated DocCount and AvLength
77 MSG_ADDDOCUMENT, // Add Document
78 MSG_CANCEL, // Cancel
79 MSG_DELETEDOCUMENTTERM, // Delete Document by term
80 MSG_COMMIT, // Commit
81 MSG_REPLACEDOCUMENT, // Replace Document
82 MSG_REPLACEDOCUMENTTERM, // Replace Document by term
83 MSG_DELETEDOCUMENT, // Delete Document
84 MSG_WRITEACCESS, // Upgrade to WritableDatabase
85 MSG_GETMETADATA, // Get metadata
86 MSG_SETMETADATA, // Set metadata
87 MSG_ADDSPELLING, // Add a spelling
88 MSG_REMOVESPELLING, // Remove a spelling
89 MSG_GETMSET, // Get MSet
90 MSG_SHUTDOWN, // Shutdown
91 MSG_METADATAKEYLIST, // Iterator for metadata keys
92 MSG_FREQS, // Get termfreq and collfreq
93 MSG_UNIQUETERMS, // Get number of unique terms in doc
94 MSG_POSITIONLISTCOUNT, // Get PositionList length
95 MSG_MAX
98 /// Reply types (server -> client).
99 enum reply_type {
100 REPLY_UPDATE, // Updated database stats
101 REPLY_EXCEPTION, // Exception
102 REPLY_DONE, // Done sending list
103 REPLY_ALLTERMS, // All Terms
104 REPLY_COLLFREQ, // Get Collection Frequency
105 REPLY_DOCDATA, // Get Document
106 REPLY_TERMDOESNTEXIST, // Term Doesn't Exist
107 REPLY_TERMEXISTS, // Term Exists
108 REPLY_TERMFREQ, // Get Term Frequency
109 REPLY_VALUESTATS, // Value statistics
110 REPLY_DOCLENGTH, // Get Doc Length
111 REPLY_STATS, // Stats
112 REPLY_TERMLIST, // Get Termlist
113 REPLY_POSITIONLIST, // Get PositionList
114 REPLY_POSTLISTSTART, // Start of a postlist
115 REPLY_POSTLISTITEM, // Item in body of a postlist
116 REPLY_VALUE, // Document Value
117 REPLY_ADDDOCUMENT, // Add Document
118 REPLY_RESULTS, // Results (MSet)
119 REPLY_METADATA, // Metadata
120 REPLY_METADATAKEYLIST, // Iterator for metadata keys
121 REPLY_FREQS, // Get termfreq and collfreq
122 REPLY_UNIQUETERMS, // Get number of unique terms in doc
123 REPLY_POSITIONLISTCOUNT, // Get PositionList length
124 REPLY_REMOVESPELLING, // Remove a spelling
125 REPLY_MAX
128 #endif // XAPIAN_INCLUDED_REMOTEPROTOCOL_H