client-query-cache 0.13.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.
Files changed (109) hide show
  1. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/PKG-INFO +2 -1
  2. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/README.md +1 -0
  3. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/Cargo.lock +24 -0
  4. client_query_cache-0.14.1/native/shared-index/Cargo.toml +38 -0
  5. client_query_cache-0.14.1/native/shared-index/deny.toml +18 -0
  6. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/array/tests.rs +12 -0
  7. client_query_cache-0.14.1/native/shared-index/src/hash/tests.rs +20 -0
  8. client_query_cache-0.14.1/native/shared-index/src/hash.rs +15 -0
  9. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/index/tests.rs +15 -11
  10. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/index.rs +2 -3
  11. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/key_encoder.rs +6 -1
  12. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/keys.rs +18 -18
  13. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/lib.rs +2 -4
  14. client_query_cache-0.14.1/native/shared-index/src/local_cache/selective.rs +274 -0
  15. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/local_cache/shared.rs +45 -168
  16. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/local_cache.rs +490 -266
  17. client_query_cache-0.14.1/native/shared-index/src/probes/tests.rs +89 -0
  18. client_query_cache-0.14.1/native/shared-index/src/probes.rs +133 -0
  19. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/python.rs +27 -195
  20. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/ring/tests.rs +16 -10
  21. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/ring.rs +16 -5
  22. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/pyproject.toml +22 -22
  23. client_query_cache-0.14.1/rust-toolchain.toml +4 -0
  24. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/__init__.py +2 -0
  25. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/canonical.py +6 -6
  26. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/collation.py +1 -1
  27. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/collection_metadata.py +0 -4
  28. client_query_cache-0.14.1/src/client_query_cache/_core/config.py +62 -0
  29. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/contracts.pyi +26 -26
  30. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/cursor_capture.py +9 -1
  31. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/entries.py +1 -18
  32. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/errors.py +13 -0
  33. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/keys.py +0 -16
  34. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/namespace_metadata.py +1 -1
  35. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/native.py +7 -3
  36. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/order_sensitive_keys.py +4 -4
  37. client_query_cache-0.14.1/src/client_query_cache/_core/selective_invalidation.py +288 -0
  38. client_query_cache-0.14.1/src/client_query_cache/_core/selective_projection.py +155 -0
  39. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/snapshots.py +3 -81
  40. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_events.py +61 -11
  41. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/adapters.py +127 -44
  42. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/attachment.py +113 -53
  43. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/coordinator.py +149 -119
  44. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/wire.py +1 -1
  45. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared_index.pyi +23 -74
  46. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/__init__.py +3 -1
  47. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/collection.py +63 -16
  48. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/cursors.py +26 -3
  49. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/manager.py +22 -3
  50. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/streams.py +63 -14
  51. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/otel.py +3 -0
  52. client_query_cache-0.14.1/src/client_query_cache/py.typed +0 -0
  53. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/shared.py +19 -5
  54. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/__init__.py +3 -1
  55. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/collection.py +63 -16
  56. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/cursors.py +26 -3
  57. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/manager.py +22 -3
  58. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/streams.py +63 -12
  59. client_query_cache-0.13.0/native/shared-index/Cargo.toml +0 -39
  60. client_query_cache-0.13.0/native/shared-index/deny.toml +0 -16
  61. client_query_cache-0.13.0/native/shared-index/src/echo/tests.rs +0 -303
  62. client_query_cache-0.13.0/native/shared-index/src/echo.rs +0 -343
  63. client_query_cache-0.13.0/native/shared-index/src/hash/tests.rs +0 -11
  64. client_query_cache-0.13.0/native/shared-index/src/hash.rs +0 -28
  65. client_query_cache-0.13.0/native/shared-index/src/relay/tests.rs +0 -130
  66. client_query_cache-0.13.0/native/shared-index/src/relay.rs +0 -134
  67. client_query_cache-0.13.0/rust-toolchain.toml +0 -5
  68. client_query_cache-0.13.0/src/client_query_cache/_core/__init__.py +0 -44
  69. client_query_cache-0.13.0/src/client_query_cache/_core/lifecycle.py +0 -8
  70. client_query_cache-0.13.0/src/client_query_cache/_core/locking.py +0 -139
  71. client_query_cache-0.13.0/src/client_query_cache/_core/lru.py +0 -164
  72. client_query_cache-0.13.0/src/client_query_cache/_core/manager.py +0 -1866
  73. client_query_cache-0.13.0/src/client_query_cache/_core/namespace.py +0 -64
  74. client_query_cache-0.13.0/src/client_query_cache/_core/retention.py +0 -219
  75. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/LICENSE +0 -0
  76. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/array.rs +0 -0
  77. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/clock.rs +0 -0
  78. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/frames/tests.rs +0 -0
  79. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/frames.rs +0 -0
  80. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/index/support_tests.rs +0 -0
  81. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/memory/support_tests.rs +0 -0
  82. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/memory/tests.rs +0 -0
  83. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/memory.rs +0 -0
  84. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/native/shared-index/src/sync.rs +0 -0
  85. {client_query_cache-0.13.0/src/client_query_cache/_shared → client_query_cache-0.14.1/src/client_query_cache/_core}/__init__.py +0 -0
  86. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/codec.py +0 -0
  87. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/count_reads.py +0 -0
  88. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/find_one_reads.py +0 -0
  89. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/find_reads.py +0 -0
  90. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/identity_reads.py +0 -0
  91. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/projection.py +0 -0
  92. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/query_filters.py +0 -0
  93. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/read_classification.py +0 -0
  94. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/read_validation.py +0 -0
  95. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_activation.py +0 -0
  96. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_cost.py +0 -0
  97. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_health.py +0 -0
  98. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_options.py +0 -0
  99. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/stream_startup.py +0 -0
  100. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/traversal.py +0 -0
  101. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_core/unique_keys.py +0 -0
  102. /client_query_cache-0.13.0/src/client_query_cache/py.typed → /client_query_cache-0.14.1/src/client_query_cache/_shared/__init__.py +0 -0
  103. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/diagnostics.py +0 -0
  104. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_shared/shared_index.py +0 -0
  105. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/_types.py +0 -0
  106. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/database.py +0 -0
  107. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/asynchronous/shared.py +0 -0
  108. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/database.py +0 -0
  109. {client_query_cache-0.13.0 → client_query_cache-0.14.1}/src/client_query_cache/synchronous/shared.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: client-query-cache
3
- Version: 0.13.0
3
+ Version: 0.14.1
4
4
  Classifier: Framework :: AsyncIO
5
5
  Classifier: Operating System :: POSIX :: Linux
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
@@ -29,6 +29,7 @@ Project-URL: Repository, https://github.com/alessio-locatelli/client-query-cache
29
29
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/client-query-cache)](https://alessio-locatelli.github.io/client-query-cache/getting-started/installation/)
30
30
  [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/alessio-locatelli/client-query-cache/actions/workflows/test.yml)
31
31
  [![Typing](https://img.shields.io/pypi/types/client-query-cache)](https://pypi.org/project/client-query-cache/)
32
+ [![SLSA Build Level 2](https://slsa.dev/images/gh-badge-level2.svg)](https://alessio-locatelli.github.io/client-query-cache/getting-started/installation/#verify-release-provenance)
32
33
 
33
34
  **Speed up read-heavy, high-throughput Python applications.** `client-query-cache` serves eligible repeated PyMongo reads from memory, reducing read latency and avoiding MongoDB round trips on cache hits.
34
35
 
@@ -4,6 +4,7 @@
4
4
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/client-query-cache)](https://alessio-locatelli.github.io/client-query-cache/getting-started/installation/)
5
5
  [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/alessio-locatelli/client-query-cache/actions/workflows/test.yml)
6
6
  [![Typing](https://img.shields.io/pypi/types/client-query-cache)](https://pypi.org/project/client-query-cache/)
7
+ [![SLSA Build Level 2](https://slsa.dev/images/gh-badge-level2.svg)](https://alessio-locatelli.github.io/client-query-cache/getting-started/installation/#verify-release-provenance)
7
8
 
8
9
  **Speed up read-heavy, high-throughput Python applications.** `client-query-cache` serves eligible repeated PyMongo reads from memory, reducing read latency and avoiding MongoDB round trips on cache hits.
9
10
 
@@ -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"
@@ -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;
@@ -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
- // Each pair has the same full hash in namespace 1, including unequal-length keys.
485
- const COLLISIONS: [(&[u8], &[u8]); 2] = [
493
+ const FULL_HASH_COLLISIONS_IN_NAMESPACE_ONE: [(&[u8], &[u8]); 2] = [
486
494
  (
487
- &[0; 16],
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
- &[0; 8],
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 COLLISIONS {
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 = 3;
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 word + 1..self.occupied_bins.len() {
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
  }
@@ -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(buffer, &index.to_string(), &item, scalar_encoder)?;
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
  }
@@ -67,7 +67,7 @@ pub(crate) struct Canonicalizer {
67
67
  mapping_abc: Py<PyAny>,
68
68
  sequence_abc: Py<PyAny>,
69
69
  unsupported: Py<PyType>,
70
- reference: Py<PyAny>,
70
+ generic: Py<PyAny>,
71
71
  }
72
72
 
73
73
  impl Canonicalizer {
@@ -227,7 +227,7 @@ impl Canonicalizer {
227
227
  || value.is_instance(self.mapping_abc.bind(py))?
228
228
  || (value.is_instance(self.sequence_abc.bind(py))? && !is_string_like(value))
229
229
  {
230
- return self.reference.bind(py).call1((value,));
230
+ return self.generic.bind(py).call1((value,));
231
231
  }
232
232
  if let Err(error) = value.hash() {
233
233
  if error.is_instance_of::<PyTypeError>(py) {
@@ -264,7 +264,7 @@ impl Canonicalizer {
264
264
  mapping_abc: Py<PyAny>,
265
265
  sequence_abc: Py<PyAny>,
266
266
  unsupported: Py<PyType>,
267
- reference: Py<PyAny>,
267
+ generic: Py<PyAny>,
268
268
  ) -> Self {
269
269
  Self {
270
270
  canonical_tag,
@@ -275,7 +275,7 @@ impl Canonicalizer {
275
275
  mapping_abc,
276
276
  sequence_abc,
277
277
  unsupported,
278
- reference,
278
+ generic,
279
279
  }
280
280
  }
281
281
 
@@ -302,8 +302,8 @@ pub(crate) struct OrderedKeys {
302
302
  canonical_tags: [Py<PyAny>; 4],
303
303
  int64_type: Py<PyAny>,
304
304
  decimal_type: Py<PyAny>,
305
- reference: Py<PyAny>,
306
- discriminator_reference: Py<PyAny>,
305
+ generic: Py<PyAny>,
306
+ generic_discriminator: Py<PyAny>,
307
307
  }
308
308
 
309
309
  impl OrderedKeys {
@@ -374,12 +374,12 @@ impl OrderedKeys {
374
374
  || value.is_instance(canonicalizer.mapping_abc.bind(py))?
375
375
  || (value.is_instance(canonicalizer.sequence_abc.bind(py))? && !is_string_like(value))
376
376
  {
377
- let reference = if distinguish {
378
- &self.discriminator_reference
377
+ let generic = if distinguish {
378
+ &self.generic_discriminator
379
379
  } else {
380
- &self.reference
380
+ &self.generic
381
381
  };
382
- return Ok(Pending::Leaf(reference.bind(py).call1((value,))?));
382
+ return Ok(Pending::Leaf(generic.bind(py).call1((value,))?));
383
383
  }
384
384
  if distinguish {
385
385
  if value.is_instance(self.int64_type.bind(py))? {
@@ -462,8 +462,8 @@ impl OrderedKeys {
462
462
  pending_tags: [Py<PyAny>; 4],
463
463
  int64_type: Py<PyAny>,
464
464
  decimal_type: Py<PyAny>,
465
- reference: Py<PyAny>,
466
- discriminator_reference: Py<PyAny>,
465
+ generic: Py<PyAny>,
466
+ generic_discriminator: Py<PyAny>,
467
467
  ) -> PyResult<Self> {
468
468
  let canonical = |tag: &Py<PyAny>| -> PyResult<Py<PyAny>> {
469
469
  Ok(tag.bind(py).getattr(intern!(py, "canonical"))?.unbind())
@@ -480,8 +480,8 @@ impl OrderedKeys {
480
480
  canonical_tags,
481
481
  int64_type,
482
482
  decimal_type,
483
- reference,
484
- discriminator_reference,
483
+ generic,
484
+ generic_discriminator,
485
485
  })
486
486
  }
487
487
 
@@ -510,13 +510,13 @@ pub(crate) struct UnsafeScan {
510
510
  prefixes: Vec<String>,
511
511
  mapping_abc: Py<PyAny>,
512
512
  sequence_abc: Py<PyAny>,
513
- reference: Py<PyAny>,
513
+ generic: Py<PyAny>,
514
514
  }
515
515
 
516
516
  impl UnsafeScan {
517
517
  fn delegate(&self, node: &Bound<'_, PyAny>) -> PyResult<bool> {
518
518
  let py = node.py();
519
- self.reference
519
+ self.generic
520
520
  .bind(py)
521
521
  .call1((node, self.key_set.bind(py)))?
522
522
  .is_truthy()
@@ -599,7 +599,7 @@ impl UnsafeScan {
599
599
  prefixes: &Bound<'_, PyAny>,
600
600
  mapping_abc: Py<PyAny>,
601
601
  sequence_abc: Py<PyAny>,
602
- reference: Py<PyAny>,
602
+ generic: Py<PyAny>,
603
603
  ) -> PyResult<Self> {
604
604
  Ok(Self {
605
605
  keys: key_set.extract()?,
@@ -608,7 +608,7 @@ impl UnsafeScan {
608
608
  prefixes: prefixes.extract()?,
609
609
  mapping_abc,
610
610
  sequence_abc,
611
- reference,
611
+ generic,
612
612
  })
613
613
  }
614
614
 
@@ -12,8 +12,6 @@
12
12
  mod array;
13
13
  #[cfg(not(loom))]
14
14
  mod clock;
15
- #[cfg(not(loom))]
16
- mod echo;
17
15
  mod frames;
18
16
  mod hash;
19
17
  mod index;
@@ -24,9 +22,9 @@ mod keys;
24
22
  #[cfg(all(feature = "python", not(loom)))]
25
23
  mod local_cache;
26
24
  mod memory;
25
+ #[cfg(not(loom))]
26
+ mod probes;
27
27
  #[cfg(all(feature = "python", not(loom)))]
28
28
  mod python;
29
- #[cfg(not(loom))]
30
- mod relay;
31
29
  mod ring;
32
30
  mod sync;