pigeonhole-db 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Cargo.lock +16 -16
- data/Cargo.toml +5 -5
- data/lib/pigeonhole/version.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/io-event-1.22.3/IO_Event.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/io-event-1.22.3/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/io-event-1.22.3/mkmf.log +26 -26
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/json-3.1.0/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/json-3.1.0/json/ext/generator.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/json-3.1.0/json/ext/parser.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/json-3.1.0/mkmf.log +19 -19
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/prism-1.9.0/gem_make.out +9 -9
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/prism-1.9.0/mkmf.log +6 -6
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/prism-1.9.0/prism/prism.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/rbs-4.2.0/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/rbs-4.2.0/mkmf.log +7 -7
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/rbs-4.2.0/rbs_extension.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/io-event-1.22.3/ext/Makefile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/io-event-1.22.3/lib/IO_Event.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/json-3.1.0/ext/json/ext/generator/Makefile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/json-3.1.0/ext/json/ext/parser/Makefile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/json-3.1.0/lib/json/ext/generator.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/json-3.1.0/lib/json/ext/parser.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/ext/prism/Makefile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/ext/rbs_extension/Makefile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/lib/rbs_extension.so +0 -0
- data/vendor/cache/Cargo.toml +2 -2
- data/vendor/cache/src/lib.rs +37 -0
- data/vendor/cache/src/loom_tests.rs +32 -0
- data/vendor/cache/src/s3fifo.rs +239 -11
- data/vendor/cache/src/sync.rs +4 -4
- data/vendor/compaction/Cargo.toml +6 -6
- data/vendor/compaction/src/cursor.rs +86 -4
- data/vendor/compaction/src/job.rs +24 -2
- data/vendor/engine/Cargo.toml +11 -11
- data/vendor/engine/src/admission.rs +3 -1
- data/vendor/engine/src/catalog.rs +39 -4
- data/vendor/engine/src/check.rs +59 -20
- data/vendor/engine/src/compact.rs +2 -2
- data/vendor/engine/src/engine/hooks.rs +144 -2
- data/vendor/engine/src/engine/info.rs +6 -0
- data/vendor/engine/src/engine.rs +1492 -50
- data/vendor/engine/src/external_registry.rs +447 -0
- data/vendor/engine/src/feed.rs +313 -84
- data/vendor/engine/src/feed_reader/catalog.rs +490 -0
- data/vendor/engine/src/feed_reader/history.rs +236 -0
- data/vendor/engine/src/feed_reader/read_ahead.rs +241 -0
- data/vendor/engine/src/feed_reader/token.rs +232 -0
- data/vendor/engine/src/feed_reader.rs +970 -852
- data/vendor/engine/src/feed_stop_loom.rs +73 -0
- data/vendor/engine/src/flush.rs +29 -4
- data/vendor/engine/src/io_count.rs +190 -0
- data/vendor/engine/src/large.rs +4 -1
- data/vendor/engine/src/lib.rs +16 -2
- data/vendor/engine/src/maintenance.rs +2 -2
- data/vendor/engine/src/manifest.rs +38 -6
- data/vendor/engine/src/nonblocking.rs +3 -3
- data/vendor/engine/src/options.rs +26 -0
- data/vendor/engine/src/punch.rs +282 -0
- data/vendor/engine/src/range_copy.rs +365 -0
- data/vendor/engine/src/read/keys.rs +37 -5
- data/vendor/engine/src/read/reduce.rs +1 -0
- data/vendor/engine/src/read.rs +7 -0
- data/vendor/engine/src/row_cache.rs +24 -0
- data/vendor/engine/src/shard/tablets.rs +127 -31
- data/vendor/engine/src/shard.rs +1006 -33
- data/vendor/engine/src/source.rs +105 -12
- data/vendor/engine/src/write.rs +310 -4
- data/vendor/format/Cargo.toml +1 -1
- data/vendor/format/src/shm.rs +10 -0
- data/vendor/format/src/superblock.rs +9 -2
- data/vendor/format/src/wal.rs +818 -16
- data/vendor/io/Cargo.toml +3 -3
- data/vendor/io/src/count.rs +76 -0
- data/vendor/io/src/file.rs +70 -0
- data/vendor/io/src/lib.rs +2 -0
- data/vendor/io/src/os/unix.rs +124 -0
- data/vendor/io/src/os/windows.rs +51 -0
- data/vendor/io/src/pread.rs +26 -0
- data/vendor/io/src/sim.rs +81 -9
- data/vendor/io/src/sys.rs +53 -0
- data/vendor/io/src/uring.rs +28 -0
- data/vendor/io/src/vfs.rs +4 -0
- data/vendor/memory/Cargo.toml +4 -4
- data/vendor/memory/src/hooks.rs +6 -0
- data/vendor/memory/src/ivf.rs +67 -1
- data/vendor/memory/src/lib.rs +4 -1
- data/vendor/memory/src/recall/pool.rs +872 -0
- data/vendor/memory/src/recall.rs +351 -273
- data/vendor/memory/src/store.rs +15 -0
- data/vendor/memtable/Cargo.toml +3 -3
- data/vendor/pager/Cargo.toml +3 -3
- data/vendor/pager/src/alloc.rs +430 -0
- data/vendor/pager/src/lib.rs +114 -0
- data/vendor/pigeonhole/Cargo.toml +6 -5
- data/vendor/pigeonhole/src/db.rs +91 -2
- data/vendor/pigeonhole/src/error.rs +2 -1
- data/vendor/pigeonhole/src/feed.rs +210 -6
- data/vendor/pigeonhole/src/lib.rs +3 -0
- data/vendor/pigeonhole/src/metrics.rs +37 -0
- data/vendor/pigeonhole/src/nonblocking.rs +94 -111
- data/vendor/pigeonhole/src/options.rs +69 -0
- data/vendor/pigeonhole/src/replication.rs +601 -11
- data/vendor/pigeonhole/src/write.rs +81 -0
- data/vendor/runtime/Cargo.toml +2 -2
- data/vendor/shm/Cargo.toml +3 -3
- data/vendor/shm/src/region.rs +20 -2
- data/vendor/sst/Cargo.toml +4 -4
- data/vendor/sst/src/blob.rs +85 -7
- data/vendor/sst/src/iter.rs +98 -2
- data/vendor/sst/src/lib.rs +11 -2
- data/vendor/sst/src/writer.rs +12 -2
- data/vendor/text/Cargo.toml +2 -2
- data/vendor/text/src/block.rs +638 -0
- data/vendor/text/src/error.rs +8 -3
- data/vendor/text/src/fuzzy.rs +1 -1
- data/vendor/text/src/index.rs +1055 -80
- data/vendor/text/src/layout.rs +63 -2
- data/vendor/text/src/lib.rs +5 -1
- data/vendor/text/src/maxscore.rs +481 -94
- data/vendor/text/src/merged.rs +470 -0
- data/vendor/text/src/search.rs +1278 -341
- data/vendor/text/src/stats.rs +431 -0
- data/vendor/vector/Cargo.toml +2 -2
- data/vendor/vector/src/hooks.rs +33 -4
- data/vendor/vector/src/index.rs +498 -69
- data/vendor/wal/Cargo.toml +3 -3
- data/vendor/wal/src/feed.rs +313 -19
- data/vendor/wal/src/recovery.rs +31 -1
- data/vendor/wal/src/stream.rs +28 -0
- metadata +15 -1
data/vendor/text/src/layout.rs
CHANGED
|
@@ -15,6 +15,10 @@ pub(crate) const GLOBAL: &[u8] = b"G";
|
|
|
15
15
|
pub(crate) const POST: &str = "post";
|
|
16
16
|
/// `P{t}`: one column per document, its positions as ascending LEB128 deltas.
|
|
17
17
|
pub(crate) const POS: &str = "pos";
|
|
18
|
+
/// `P{t}`, in a version 2 index: one column per packed block of postings, the qualifier the
|
|
19
|
+
/// block's last document id, the value the block ([`crate::block`]). Added to the table by
|
|
20
|
+
/// the first [`Index::pack`](crate::Index::pack).
|
|
21
|
+
pub(crate) const POSTB: &str = "postb";
|
|
18
22
|
/// `P{t}`: a counter, the term's document frequency, at [`N`].
|
|
19
23
|
pub(crate) const DF: &str = "df";
|
|
20
24
|
/// `P{t}`: a `max` aggregate, the largest term frequency any posting had (MaxScore, M1).
|
|
@@ -44,10 +48,67 @@ pub(crate) const TOKENIZER: &[u8] = b"tokenizer";
|
|
|
44
48
|
pub(crate) const FINGERPRINT: &[u8] = b"fingerprint";
|
|
45
49
|
/// The normaliser's Unicode version, for diagnostics (D309 rev 6 §A.9).
|
|
46
50
|
pub(crate) const NORMALIZER_UNICODE: &[u8] = b"normalizer-unicode";
|
|
47
|
-
///
|
|
51
|
+
/// The index's state, which every search and every write through the index reads:
|
|
52
|
+
/// - **absent:** layout version 1, and no repair running;
|
|
53
|
+
/// - **[`PACKED`]:** layout version 2, and no repair running;
|
|
54
|
+
/// - **anything else** (it is written empty): [`Index::repair`](crate::Index::repair) is
|
|
55
|
+
/// running, and the read fails with `Busy`.
|
|
56
|
+
///
|
|
57
|
+
/// One cell for both, so a search learns the layout from the read it already made for the
|
|
58
|
+
/// repair flag (#1585), and a handle opened before the first pack needs no reopen. A 1.2
|
|
59
|
+
/// build, which knows only "present means a repair", fails with `Busy` on a packed index it
|
|
60
|
+
/// had open, where it would otherwise search past the packed postings without knowing.
|
|
48
61
|
pub(crate) const REPAIR: &[u8] = b"repair";
|
|
49
|
-
|
|
62
|
+
/// [`REPAIR`]'s value in a version 2 index with no repair running.
|
|
63
|
+
pub(crate) const PACKED: &[u8] = b"v2";
|
|
64
|
+
/// A stopped pack's cursor (#1585): [`pack_cursor`] of the last posting cell its last chunk
|
|
65
|
+
/// took, or empty before its first chunk. Absent when no pack is part way.
|
|
66
|
+
pub(crate) const PACK_AFTER: &[u8] = b"pack-after";
|
|
67
|
+
/// A stopped rebuild's cursor (#1756): the last source row it reconciled, which
|
|
68
|
+
/// [`Index::resume_rebuild_with`](crate::Index::resume_rebuild_with) continues after. Absent
|
|
69
|
+
/// when no rebuild is pending.
|
|
70
|
+
pub(crate) const REBUILD_AFTER: &[u8] = b"rebuild-after";
|
|
71
|
+
/// An index created unfilled (#1722 PR 2c): present from
|
|
72
|
+
/// [`Index::create_unfilled`](crate::Index::create_unfilled) until a walk of the whole
|
|
73
|
+
/// source (its fill, or a rebuild or repair that reaches the end) finishes. Unlike
|
|
74
|
+
/// [`REBUILD_AFTER`], a client's rebuild never sets it: until it goes, the index lacks
|
|
75
|
+
/// source rows rather than holding stale postings for some.
|
|
76
|
+
pub(crate) const UNFILLED: &[u8] = b"unfilled";
|
|
77
|
+
|
|
78
|
+
/// The layout an index is created with: postings as one cell a document.
|
|
50
79
|
pub(crate) const LAYOUT_VERSION: u64 = 1;
|
|
80
|
+
/// The layout after the first [`Index::pack`](crate::Index::pack) (#1585, ICR 0143): packed
|
|
81
|
+
/// blocks ([`POSTB`]) under the cells, and tombstones ([`TOMBSTONE`]) where a posting is
|
|
82
|
+
/// deleted.
|
|
83
|
+
pub(crate) const LAYOUT_PACKED: u64 = 2;
|
|
84
|
+
|
|
85
|
+
/// A deleted posting's [`POST`] value in a version 2 index (its [`POS`] value is empty): it
|
|
86
|
+
/// hides the document's posting in a packed block until the next pack removes both. A real
|
|
87
|
+
/// posting has a frequency of at least 1, and a real position list is never empty.
|
|
88
|
+
pub(crate) const TOMBSTONE: u64 = 0;
|
|
89
|
+
|
|
90
|
+
/// A pack cursor: the term's length (`u32` LE), the term, then the document id.
|
|
91
|
+
pub(crate) fn pack_cursor(term: &[u8], doc: &[u8]) -> Vec<u8> {
|
|
92
|
+
let mut v = Vec::with_capacity(4 + term.len() + doc.len());
|
|
93
|
+
v.extend_from_slice(&(term.len() as u32).to_le_bytes());
|
|
94
|
+
v.extend_from_slice(term);
|
|
95
|
+
v.extend_from_slice(doc);
|
|
96
|
+
v
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// A pack cursor's term and document id; `None` for the empty cursor (from the top).
|
|
100
|
+
pub(crate) fn unpack_cursor(b: &[u8]) -> Result<Option<(&[u8], &[u8])>> {
|
|
101
|
+
if b.is_empty() {
|
|
102
|
+
return Ok(None);
|
|
103
|
+
}
|
|
104
|
+
let bad = || Error::Corruption("a pack cursor doesn't parse".into());
|
|
105
|
+
let n = u32::from_le_bytes(b.get(..4).ok_or_else(bad)?.try_into().expect("4 bytes")) as usize;
|
|
106
|
+
let rest = &b[4..];
|
|
107
|
+
if rest.len() < n {
|
|
108
|
+
return Err(bad());
|
|
109
|
+
}
|
|
110
|
+
Ok(Some(rest.split_at(n)))
|
|
111
|
+
}
|
|
51
112
|
|
|
52
113
|
pub(crate) fn post_row(term: &str) -> Vec<u8> {
|
|
53
114
|
[POST_PREFIX, term.as_bytes()].concat()
|
data/vendor/text/src/lib.rs
CHANGED
|
@@ -46,23 +46,27 @@
|
|
|
46
46
|
|
|
47
47
|
#![forbid(unsafe_code)]
|
|
48
48
|
|
|
49
|
+
mod block;
|
|
49
50
|
mod error;
|
|
50
51
|
mod fuzzy;
|
|
51
52
|
mod highlight;
|
|
52
53
|
mod index;
|
|
53
54
|
mod layout;
|
|
54
55
|
mod maxscore;
|
|
56
|
+
mod merged;
|
|
55
57
|
mod query;
|
|
56
58
|
mod search;
|
|
57
59
|
mod sloppy;
|
|
60
|
+
mod stats;
|
|
58
61
|
mod tokenizer;
|
|
59
62
|
|
|
60
63
|
pub use error::{Error, QueryErrorKind, Result};
|
|
61
64
|
pub use highlight::{Match, Snippet, snippet};
|
|
62
|
-
pub use index::{Index, IndexStats, ReadIndex, RebuildStats};
|
|
65
|
+
pub use index::{Index, IndexStats, PackOptions, PackStats, ReadIndex, RebuildStats};
|
|
63
66
|
pub use layout::{IndexOptions, Normalization, Source};
|
|
64
67
|
pub use query::{Clause, Fuzziness, Query};
|
|
65
68
|
pub use search::{FuzzyStats, Hit, Search, SearchStats};
|
|
69
|
+
pub use stats::QueryStats;
|
|
66
70
|
pub use tokenizer::{Token, Tokenizer};
|
|
67
71
|
|
|
68
72
|
/// The user guide's text-search page and the crate README, compiled and run as doctests.
|