[honey] New format for more keys in postlist table
[xapian.git] / xapian-core / backends / honey / honey_defs.h
blob55418c7dca750ea6fabb28bd85cf777446ec8f32
1 /** @file honey_defs.h
2 * @brief Definitions, types, etc for use inside honey.
3 */
4 /* Copyright (C) 2010,2014,2015,2017,2018 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_HONEY_DEFS_H
22 #define XAPIAN_INCLUDED_HONEY_DEFS_H
24 #include "internaltypes.h"
26 #define SST_SEARCH
28 /// Honey table extension.
29 #define HONEY_TABLE_EXTENSION "honey"
31 /// Default B-tree block size.
32 #define HONEY_DEFAULT_BLOCKSIZE 8192
34 /// Minimum B-tree block size.
35 #define HONEY_MIN_BLOCKSIZE 2048
37 /// Maximum B-tree block size.
38 #define HONEY_MAX_BLOCKSIZE 65536
40 /// Maximum key length.
41 #define HONEY_MAX_KEY_LEN 255
43 /** The largest docid value supported by honey.
45 * The disk format supports 64-bit docids, but if Xapian::docid is narrower
46 * then it's the largest value supported by the type that matters here.
48 #define HONEY_MAX_DOCID Xapian::docid(0xffffffffffffffff)
50 namespace Honey {
52 enum table_type {
53 POSTLIST,
54 DOCDATA,
55 TERMLIST,
56 POSITION,
57 SPELLING,
58 SYNONYM,
59 MAX_
62 /// Postlist key second bytes when first byte is zero.
63 enum {
64 KEY_USER_METADATA = 0x00,
65 KEY_VALUE_STATS = 0x01,
66 KEY_VALUE_STATS_HI = 0x08,
67 KEY_VALUE_CHUNK = 0x09,
68 KEY_VALUE_CHUNK_HI = 0xe1, // (0xe1 for slots > 26)
69 /* 0xe2-0xe6 inclusive unused currently. */
70 /* 0xe7-0xee inclusive reserved for doc max wdf chunks. */
71 /* 0xef-0xf6 inclusive reserved for unique terms chunks. */
72 KEY_DOCLEN_CHUNK = 0xf7,
73 KEY_DOCLEN_CHUNK_HI = 0xfe,
74 KEY_POSTING_CHUNK = 0xff
77 #define KEY_DOCLEN_PREFIX "\0\xf7"
79 static_assert(((KEY_VALUE_CHUNK_HI - KEY_VALUE_CHUNK) & 0x07) == 0,
80 "No wasted values");
84 /// A block number in a honey Btree file.
85 typedef uint4 honey_block_t;
87 /// The revision number of a honey database.
88 typedef uint4 honey_revision_number_t;
90 /// How many entries there are in a table.
91 typedef unsigned long long honey_tablesize_t;
93 #endif // XAPIAN_INCLUDED_HONEY_DEFS_H