client-query-cache 0.14.0__tar.gz → 0.14.1__tar.gz
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.
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/PKG-INFO +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/Cargo.lock +24 -0
- client_query_cache-0.14.1/native/shared-index/Cargo.toml +38 -0
- client_query_cache-0.14.1/native/shared-index/deny.toml +18 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/array/tests.rs +12 -0
- client_query_cache-0.14.1/native/shared-index/src/hash/tests.rs +20 -0
- client_query_cache-0.14.1/native/shared-index/src/hash.rs +15 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/index/tests.rs +15 -11
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/index.rs +2 -3
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/key_encoder.rs +6 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/lib.rs +2 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/local_cache/shared.rs +13 -128
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/local_cache.rs +73 -99
- client_query_cache-0.14.1/native/shared-index/src/probes/tests.rs +89 -0
- client_query_cache-0.14.1/native/shared-index/src/probes.rs +133 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/pyproject.toml +22 -22
- client_query_cache-0.14.1/rust-toolchain.toml +4 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/collation.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/namespace_metadata.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/selective_invalidation.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/adapters.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/attachment.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/coordinator.py +5 -5
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/wire.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/streams.py +1 -1
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/shared.py +4 -2
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/streams.py +1 -1
- client_query_cache-0.14.0/native/shared-index/Cargo.toml +0 -39
- client_query_cache-0.14.0/native/shared-index/deny.toml +0 -16
- client_query_cache-0.14.0/native/shared-index/src/hash/tests.rs +0 -11
- client_query_cache-0.14.0/native/shared-index/src/hash.rs +0 -28
- client_query_cache-0.14.0/rust-toolchain.toml +0 -5
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/LICENSE +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/README.md +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/array.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/clock.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/frames/tests.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/frames.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/index/support_tests.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/keys.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/local_cache/selective.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/memory/support_tests.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/memory/tests.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/memory.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/python.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/ring/tests.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/ring.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/sync.rs +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/__init__.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/__init__.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/canonical.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/codec.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/collection_metadata.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/config.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/contracts.pyi +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/count_reads.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/cursor_capture.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/entries.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/errors.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/find_one_reads.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/find_reads.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/identity_reads.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/keys.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/native.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/order_sensitive_keys.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/projection.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/query_filters.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/read_classification.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/read_validation.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/selective_projection.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/snapshots.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_activation.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_cost.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_events.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_health.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_options.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_startup.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/traversal.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/unique_keys.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/__init__.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/diagnostics.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/shared_index.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared_index.pyi +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/_types.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/__init__.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/collection.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/cursors.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/database.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/manager.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/shared.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/otel.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/py.typed +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/__init__.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/collection.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/cursors.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/database.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/manager.py +0 -0
- {client_query_cache-0.14.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/shared.py +0 -0
|
@@ -31,10 +31,13 @@ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
|
31
31
|
name = "client-query-cache-shared-index"
|
|
32
32
|
version = "0.8.0"
|
|
33
33
|
dependencies = [
|
|
34
|
+
"itoa",
|
|
34
35
|
"libc",
|
|
35
36
|
"loom",
|
|
36
37
|
"pyo3",
|
|
38
|
+
"rapidhash",
|
|
37
39
|
"rustc-hash",
|
|
40
|
+
"slab",
|
|
38
41
|
]
|
|
39
42
|
|
|
40
43
|
[[package]]
|
|
@@ -64,6 +67,12 @@ version = "0.5.0"
|
|
|
64
67
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
65
68
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
66
69
|
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "itoa"
|
|
72
|
+
version = "1.0.19"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
|
|
75
|
+
|
|
67
76
|
[[package]]
|
|
68
77
|
name = "lazy_static"
|
|
69
78
|
version = "1.5.1"
|
|
@@ -212,6 +221,15 @@ dependencies = [
|
|
|
212
221
|
"proc-macro2",
|
|
213
222
|
]
|
|
214
223
|
|
|
224
|
+
[[package]]
|
|
225
|
+
name = "rapidhash"
|
|
226
|
+
version = "4.5.1"
|
|
227
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
228
|
+
checksum = "5da7e78a036ce858e8d55b7e7dc8ba3a88b78350fd2155d3591bbd966b58589e"
|
|
229
|
+
dependencies = [
|
|
230
|
+
"rustversion",
|
|
231
|
+
]
|
|
232
|
+
|
|
215
233
|
[[package]]
|
|
216
234
|
name = "regex-automata"
|
|
217
235
|
version = "0.4.18"
|
|
@@ -262,6 +280,12 @@ version = "2.0.1"
|
|
|
262
280
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
281
|
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
|
264
282
|
|
|
283
|
+
[[package]]
|
|
284
|
+
name = "slab"
|
|
285
|
+
version = "0.4.12"
|
|
286
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
287
|
+
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
288
|
+
|
|
265
289
|
[[package]]
|
|
266
290
|
name = "smallvec"
|
|
267
291
|
version = "1.16.3"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "client-query-cache-shared-index"
|
|
3
|
+
version = "0.8.0"
|
|
4
|
+
description = "Shared index for client-query-cache worker caches."
|
|
5
|
+
repository = "https://github.com/alessio-locatelli/client-query-cache"
|
|
6
|
+
documentation = "https://alessio-locatelli.github.io/client-query-cache/"
|
|
7
|
+
edition = "2024"
|
|
8
|
+
license = "Apache-2.0"
|
|
9
|
+
# The default is publishing to any registry allowed (https://doc.rust-lang.org/1.100.0/cargo/reference/manifest.html#the-publish-field). We override it because the native crate ships only inside the Python distribution.
|
|
10
|
+
publish = false
|
|
11
|
+
|
|
12
|
+
[lib]
|
|
13
|
+
name = "_shared_index"
|
|
14
|
+
crate-type = ["cdylib"]
|
|
15
|
+
|
|
16
|
+
[features]
|
|
17
|
+
python = ["dep:itoa", "dep:pyo3", "dep:rustc-hash", "dep:slab"]
|
|
18
|
+
|
|
19
|
+
[dependencies]
|
|
20
|
+
itoa = { version = "1.0.19", optional = true }
|
|
21
|
+
rapidhash = { version = "4.5.1", default-features = false }
|
|
22
|
+
libc = "0.2.190"
|
|
23
|
+
slab = { version = "0.4.12", optional = true }
|
|
24
|
+
pyo3 = { version = "0.30.1", features = ["abi3-py314"], optional = true }
|
|
25
|
+
rustc-hash = { version = "2.1.3", optional = true }
|
|
26
|
+
|
|
27
|
+
[target.'cfg(loom)'.dependencies]
|
|
28
|
+
loom = "0.7.2"
|
|
29
|
+
|
|
30
|
+
[lints.rust]
|
|
31
|
+
# The default is warning on every cfg name Cargo does not declare (https://doc.rust-lang.org/1.100.0/rustc/check-cfg/cargo-specifics.html). We override it because the loom model tests are selected with --cfg loom.
|
|
32
|
+
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(loom)"] }
|
|
33
|
+
|
|
34
|
+
[profile.release]
|
|
35
|
+
# The default is false (https://doc.rust-lang.org/1.100.0/cargo/reference/profiles.html#lto), which optimizes across a crate's own code generation units only. We override it because whole-program optimization across the crate and PyO3 shortens the native cache entry points (reports/rust-build-profile/summary.md).
|
|
36
|
+
lto = "fat"
|
|
37
|
+
# The default is 16 (https://doc.rust-lang.org/1.100.0/cargo/reference/profiles.html#codegen-units). We override it because a single unit lets the optimizer inline across the whole extension.
|
|
38
|
+
codegen-units = 1
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# The default license allowlist is empty
|
|
2
|
+
# (https://github.com/EmbarkStudios/cargo-deny/blob/0.20.2/docs/src/checks/licenses/cfg.md#the-allow-field-optional). We override it because these permissive
|
|
3
|
+
# licenses cover the resolved native dependency graph and permit distribution.
|
|
4
|
+
[licenses]
|
|
5
|
+
allow = ["Apache-2.0", "Apache-2.0 WITH LLVM-exception", "MIT", "Unicode-3.0"]
|
|
6
|
+
|
|
7
|
+
[bans]
|
|
8
|
+
# Defaults: https://github.com/EmbarkStudios/cargo-deny/blob/0.20.2/docs/src/checks/bans/cfg.md
|
|
9
|
+
# The default is warn. We override it because duplicate versions must be resolved.
|
|
10
|
+
multiple-versions = "deny"
|
|
11
|
+
# The default is warn. We override it because unbounded dependencies hinder review.
|
|
12
|
+
wildcards = "deny"
|
|
13
|
+
|
|
14
|
+
[sources]
|
|
15
|
+
# Both defaults are warn (https://github.com/EmbarkStudios/cargo-deny/blob/0.20.2/docs/src/checks/sources/cfg.md). We override them because only crates.io is
|
|
16
|
+
# approved.
|
|
17
|
+
unknown-registry = "deny"
|
|
18
|
+
unknown-git = "deny"
|
{client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/array/tests.rs
RENAMED
|
@@ -135,3 +135,15 @@ fn clearing_releases_the_buffer() {
|
|
|
135
135
|
assert_eq!(builder.bytes.capacity(), 0);
|
|
136
136
|
assert_eq!(builder.finish().len(), MINIMUM_ENVELOPE);
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
#[test]
|
|
140
|
+
fn decimal_matches_standard_formatting_at_every_width_boundary() {
|
|
141
|
+
let boundaries = (1..u64::MAX.ilog10() + 1).flat_map(|exponent| {
|
|
142
|
+
let power = 10_u64.pow(exponent);
|
|
143
|
+
[power - 1, power]
|
|
144
|
+
});
|
|
145
|
+
for value in [0, u64::MAX].into_iter().chain(boundaries) {
|
|
146
|
+
let mut digits = [0; 20];
|
|
147
|
+
assert_eq!(decimal(value, &mut digits), value.to_string().as_bytes());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
use super::key;
|
|
2
|
+
|
|
3
|
+
const KNOWN_KEY: u64 = 0x61c8_a333_db8d_0639;
|
|
4
|
+
|
|
5
|
+
#[test]
|
|
6
|
+
fn separates_identity_and_shape_boundaries() {
|
|
7
|
+
for (identity, shape) in [(&b"a"[..], &b"bc"[..]), (b"", b"abc"), (b"abc", b"")] {
|
|
8
|
+
assert_ne!(key(0, b"ab", b"c"), key(0, identity, shape));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#[test]
|
|
13
|
+
fn separates_namespaces() {
|
|
14
|
+
assert_ne!(key(0, b"a", b"b"), key(1, b"a", b"b"));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#[test]
|
|
18
|
+
fn keeps_the_published_mapping_of_this_layout_version() {
|
|
19
|
+
assert_eq!(key(1, b"identity", b"find_one"), KNOWN_KEY);
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
use rapidhash::v3::{RapidSecrets, rapidhash_v3_seeded};
|
|
2
|
+
|
|
3
|
+
const SECRETS: RapidSecrets = RapidSecrets::seed(0x9e37_79b9_7f4a_7c15);
|
|
4
|
+
|
|
5
|
+
fn seeded(seed: u64) -> RapidSecrets {
|
|
6
|
+
RapidSecrets { seed, ..SECRETS }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pub(crate) fn key(namespace: u64, identity: &[u8], shape: &[u8]) -> u64 {
|
|
10
|
+
let identity_hash = rapidhash_v3_seeded(identity, &seeded(SECRETS.seed ^ namespace));
|
|
11
|
+
rapidhash_v3_seeded(shape, &seeded(identity_hash))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[cfg(test)]
|
|
15
|
+
mod tests;
|
{client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/index/tests.rs
RENAMED
|
@@ -443,6 +443,15 @@ fn attaches_only_to_a_complete_layout() {
|
|
|
443
443
|
assert!(Index::attach(zeroed(HEADER_WORDS)).is_none());
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
+
#[test]
|
|
447
|
+
fn rejects_a_mapping_of_another_layout_version() {
|
|
448
|
+
for version in [LAYOUT_VERSION - 1, LAYOUT_VERSION + 1] {
|
|
449
|
+
let (index, _writer) = fixture();
|
|
450
|
+
index.word(H_VERSION).store(version, Ordering::Relaxed);
|
|
451
|
+
assert!(Index::attach(index.memory).is_none());
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
446
455
|
#[test]
|
|
447
456
|
fn rejects_a_descriptor_with_an_invalid_published_layout() {
|
|
448
457
|
let (index, _writer) = fixture();
|
|
@@ -481,22 +490,17 @@ fn a_release_after_snapshot_sizing_invalidates_the_copy() {
|
|
|
481
490
|
|
|
482
491
|
#[test]
|
|
483
492
|
fn equal_hashes_do_not_replace_or_return_a_different_identity() {
|
|
484
|
-
|
|
485
|
-
const COLLISIONS: [(&[u8], &[u8]); 2] = [
|
|
493
|
+
const FULL_HASH_COLLISIONS_IN_NAMESPACE_ONE: [(&[u8], &[u8]); 2] = [
|
|
486
494
|
(
|
|
487
|
-
&[0
|
|
488
|
-
&[
|
|
489
|
-
1, 0, 0, 0, 0, 0, 0, 0, 0xae, 0x52, 0x43, 0x1c, 0xe5, 0xca, 0xe9, 0x37,
|
|
490
|
-
],
|
|
495
|
+
&[0, 0, 0, 0, 0, 0, 0, 0, 85, 215, 220, 90, 67, 123, 207, 157],
|
|
496
|
+
&[0, 0, 0, 0, 0, 0, 0, 0, 107, 59, 89, 66, 252, 252, 74, 143],
|
|
491
497
|
),
|
|
492
498
|
(
|
|
493
|
-
&[
|
|
494
|
-
&[
|
|
495
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0xbf, 0xcc, 0x1e, 0x61, 0x33, 0xe7, 0xf5, 0xc7,
|
|
496
|
-
],
|
|
499
|
+
&[34, 101, 217, 139, 55, 116, 229, 101],
|
|
500
|
+
&[0, 0, 0, 0, 0, 0, 0, 0, 181, 195, 234, 68, 174, 123, 109, 82],
|
|
497
501
|
),
|
|
498
502
|
];
|
|
499
|
-
for (first_identity, second_identity) in
|
|
503
|
+
for (first_identity, second_identity) in FULL_HASH_COLLISIONS_IN_NAMESPACE_ONE {
|
|
500
504
|
let first = query(first_identity);
|
|
501
505
|
let second = query(second_identity);
|
|
502
506
|
assert_eq!(first.hash(), second.hash());
|
|
@@ -6,7 +6,7 @@ use crate::memory::{WORD_BYTES, Words};
|
|
|
6
6
|
use crate::sync::{AtomicU64, Ordering, fence};
|
|
7
7
|
|
|
8
8
|
const MAGIC: u64 = u64::from_le_bytes(*b"cqcsidx3");
|
|
9
|
-
const LAYOUT_VERSION: u64 =
|
|
9
|
+
const LAYOUT_VERSION: u64 = 4;
|
|
10
10
|
|
|
11
11
|
const H_MAGIC: usize = 0;
|
|
12
12
|
const H_VERSION: usize = 1;
|
|
@@ -690,8 +690,7 @@ impl<M: Words> Writer<M> {
|
|
|
690
690
|
if bits != 0 {
|
|
691
691
|
return Some(word * u64::BITS as usize + bits.trailing_zeros() as usize);
|
|
692
692
|
}
|
|
693
|
-
for word in
|
|
694
|
-
let bits = self.occupied_bins[word];
|
|
693
|
+
for (word, &bits) in self.occupied_bins.iter().enumerate().skip(word + 1) {
|
|
695
694
|
if bits != 0 {
|
|
696
695
|
return Some(word * u64::BITS as usize + bits.trailing_zeros() as usize);
|
|
697
696
|
}
|
{client_query_cache-0.14.0 → client_query_cache-0.14.1}/native/shared-index/src/key_encoder.rs
RENAMED
|
@@ -105,7 +105,12 @@ impl FindKeyEncoder {
|
|
|
105
105
|
let _recursion = Recursion::enter(value.py())?;
|
|
106
106
|
let offsets = tuple(buffer, name)?;
|
|
107
107
|
for (index, item) in items.iter().enumerate() {
|
|
108
|
-
self.node(
|
|
108
|
+
self.node(
|
|
109
|
+
buffer,
|
|
110
|
+
itoa::Buffer::new().format(index),
|
|
111
|
+
&item,
|
|
112
|
+
scalar_encoder,
|
|
113
|
+
)?;
|
|
109
114
|
}
|
|
110
115
|
return finish_tuple(buffer, offsets);
|
|
111
116
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use std::collections::{
|
|
1
|
+
use std::collections::{HashMap, HashSet};
|
|
2
2
|
use std::sync::Arc;
|
|
3
3
|
|
|
4
4
|
use pyo3::prelude::*;
|
|
@@ -9,131 +9,9 @@ use super::{
|
|
|
9
9
|
};
|
|
10
10
|
use crate::clock::monotonic_ns;
|
|
11
11
|
use crate::index::{Block, Query};
|
|
12
|
+
use crate::probes::{Names, Probes};
|
|
12
13
|
use crate::python::{OwnerIndex, SessionRing};
|
|
13
14
|
|
|
14
|
-
type Names = (Arc<str>, Arc<str>);
|
|
15
|
-
|
|
16
|
-
struct Probe {
|
|
17
|
-
token: u64,
|
|
18
|
-
active: usize,
|
|
19
|
-
expires: u64,
|
|
20
|
-
sequence: u64,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
pub(super) struct Probes {
|
|
24
|
-
ttl_ns: u64,
|
|
25
|
-
entries: HashMap<Names, Probe>,
|
|
26
|
-
order: BTreeMap<u64, Names>,
|
|
27
|
-
sequence: u64,
|
|
28
|
-
next_token: u64,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
impl Probes {
|
|
32
|
-
pub(super) fn new(ttl_ns: u64) -> Self {
|
|
33
|
-
Self {
|
|
34
|
-
ttl_ns,
|
|
35
|
-
entries: HashMap::new(),
|
|
36
|
-
order: BTreeMap::new(),
|
|
37
|
-
sequence: 0,
|
|
38
|
-
next_token: 0,
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
fn expire(&mut self, now: u64) {
|
|
43
|
-
while let Some((&sequence, names)) = self.order.first_key_value() {
|
|
44
|
-
if self.entries[names].expires > now {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
let names = self.order.remove(&sequence).expect("ordered probe");
|
|
48
|
-
self.entries.remove(&names);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
fn insert(&mut self, names: Names, mut probe: Probe) -> u64 {
|
|
53
|
-
self.sequence += 1;
|
|
54
|
-
probe.sequence = self.sequence;
|
|
55
|
-
self.order.insert(self.sequence, names.clone());
|
|
56
|
-
let token = probe.token;
|
|
57
|
-
self.entries.insert(names, probe);
|
|
58
|
-
token
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
pub(super) fn begin(&mut self, names: Names, admissible: bool, capacity: usize) -> Option<u64> {
|
|
62
|
-
let now = monotonic_ns();
|
|
63
|
-
self.expire(now);
|
|
64
|
-
if !admissible {
|
|
65
|
-
return None;
|
|
66
|
-
}
|
|
67
|
-
let expires = now.saturating_add(self.ttl_ns);
|
|
68
|
-
let probe = if let Some(mut probe) = self.entries.remove(&names) {
|
|
69
|
-
self.order.remove(&probe.sequence);
|
|
70
|
-
probe.active += 1;
|
|
71
|
-
probe.expires = expires;
|
|
72
|
-
probe
|
|
73
|
-
} else {
|
|
74
|
-
if self.entries.len() >= capacity {
|
|
75
|
-
return None;
|
|
76
|
-
}
|
|
77
|
-
let token = self.next_token;
|
|
78
|
-
self.next_token += 1;
|
|
79
|
-
Probe {
|
|
80
|
-
token,
|
|
81
|
-
active: 1,
|
|
82
|
-
expires,
|
|
83
|
-
sequence: 0,
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
Some(self.insert(names, probe))
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
pub(super) fn finish(&mut self, names: &Names, token: u64) {
|
|
90
|
-
self.expire(monotonic_ns());
|
|
91
|
-
let Some(probe) = self.entries.get_mut(names) else {
|
|
92
|
-
return;
|
|
93
|
-
};
|
|
94
|
-
if probe.token != token {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if probe.active == 1 {
|
|
98
|
-
let sequence = probe.sequence;
|
|
99
|
-
self.entries.remove(names);
|
|
100
|
-
self.order.remove(&sequence);
|
|
101
|
-
} else {
|
|
102
|
-
probe.active -= 1;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
pub(super) fn active(&mut self, names: &Names, token: u64) -> bool {
|
|
107
|
-
self.expire(monotonic_ns());
|
|
108
|
-
self.entries
|
|
109
|
-
.get(names)
|
|
110
|
-
.is_some_and(|probe| probe.token == token)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
pub(super) fn invalidate(&mut self, names: &Names) {
|
|
114
|
-
if let Some(probe) = self.entries.remove(names) {
|
|
115
|
-
self.order.remove(&probe.sequence);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
pub(super) fn invalidate_database(&mut self, database: &str) {
|
|
120
|
-
let matching: Vec<_> = self
|
|
121
|
-
.entries
|
|
122
|
-
.keys()
|
|
123
|
-
.filter(|names| names.0.as_ref() == database)
|
|
124
|
-
.cloned()
|
|
125
|
-
.collect();
|
|
126
|
-
for names in matching {
|
|
127
|
-
self.invalidate(&names);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
pub(super) fn clear(&mut self) {
|
|
132
|
-
self.entries.clear();
|
|
133
|
-
self.order.clear();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
15
|
struct Published {
|
|
138
16
|
token: u64,
|
|
139
17
|
namespace: u64,
|
|
@@ -487,7 +365,7 @@ impl SharedOwner {
|
|
|
487
365
|
let capacity = state.max_namespaces;
|
|
488
366
|
Ok(shared_state(&mut state)
|
|
489
367
|
.probes
|
|
490
|
-
.begin(key, admissible, capacity))
|
|
368
|
+
.begin(key, admissible, capacity, monotonic_ns()))
|
|
491
369
|
}
|
|
492
370
|
|
|
493
371
|
fn cancel_namespace_metadata_probe(
|
|
@@ -502,7 +380,9 @@ impl SharedOwner {
|
|
|
502
380
|
.state
|
|
503
381
|
.lock()
|
|
504
382
|
.expect("local owner mutex");
|
|
505
|
-
shared_state(&mut state)
|
|
383
|
+
shared_state(&mut state)
|
|
384
|
+
.probes
|
|
385
|
+
.finish(&key, token, monotonic_ns());
|
|
506
386
|
Ok(())
|
|
507
387
|
}
|
|
508
388
|
|
|
@@ -541,7 +421,10 @@ impl SharedOwner {
|
|
|
541
421
|
.state
|
|
542
422
|
.lock()
|
|
543
423
|
.expect("local owner mutex");
|
|
544
|
-
let reserved = !state.closed
|
|
424
|
+
let reserved = !state.closed
|
|
425
|
+
&& shared_state(&mut state)
|
|
426
|
+
.probes
|
|
427
|
+
.active(&key, token, monotonic_ns());
|
|
545
428
|
let registered = if reserved {
|
|
546
429
|
state.register(py, namespace, &python_names)
|
|
547
430
|
} else {
|
|
@@ -556,7 +439,9 @@ impl SharedOwner {
|
|
|
556
439
|
});
|
|
557
440
|
(epoch, index_generation, slot)
|
|
558
441
|
});
|
|
559
|
-
shared_state(&mut state)
|
|
442
|
+
shared_state(&mut state)
|
|
443
|
+
.probes
|
|
444
|
+
.finish(&key, token, monotonic_ns());
|
|
560
445
|
Ok(metadata)
|
|
561
446
|
}
|
|
562
447
|
|