maxmind-db-rust 0.5.0-x86_64-linux → 0.6.0-x86_64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4591f5b374ba228f60f15ade6d3678118fc5f0afe9754a9beac70747edc30896
4
- data.tar.gz: fcbb9dbef604ad05b87b4e49ec15b27d6053e0b993ce2591c91d900c0592bca6
3
+ metadata.gz: 9a5acfd1e34141f95708f52bc8ded3d7c7a66f3e265de27f5f6622cc54937dfd
4
+ data.tar.gz: 57eed3dd6edfc9ecfc9fa460ec6bcc9de1d84d74cf9a40e02539bc37a24548bd
5
5
  SHA512:
6
- metadata.gz: 302811a952700129f605a4bc7f5b7d791bfb113d52782b3269c9a7feea1050885c5c7f04cab7c87164ae5588a065492de91ab26b5f7170b8ac20e70834912d5a
7
- data.tar.gz: 4ce1527671c972eb3eb49bc4a15cca9a93b7451068f8ac48590f33830b225d3284eee26fa6edaaf17769af771f18bee9f25f2aec001013ee2cd230d0afbf0d68
6
+ metadata.gz: e9081ef975be35d614db2ba467ace5729f2c0467bc5bac354d2e50d64526f7cfb48c87f152f1dbeea3eb4c816cfc97b5b5dedd5b0cbd7882b41367690df62611
7
+ data.tar.gz: fbf97ed0b4805005989354dcb972df5ffb59bb14f455273eec2e491746a4b074a0eebff7a00a456ffc67a7c11957e9ed5cecdca4fd5d5a10d7c7339f228d0300
data/CHANGELOG.md CHANGED
@@ -5,6 +5,64 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.0] - 2026-07-19
9
+
10
+ ### Added
11
+
12
+ - Added `Reader#verify` for opt-in comprehensive database integrity checks
13
+ using the verifier introduced by `maxminddb` 0.30.0.
14
+ - Added iteration and shared-reader thread-scaling benchmarks, including a
15
+ cache-root retention check across thread churn.
16
+
17
+ ### Performance
18
+
19
+ - Batched Ruby array and hash insertion while decoding MMDB records to reduce
20
+ protected Ruby C API calls during full-record lookups.
21
+ - Replaced per-thread string caches with one fixed-size process cache that uses
22
+ its Ruby root array directly, improving reuse while bounding retained memory.
23
+ - Batched `get_many` and `get_many_path` result construction to reduce Ruby
24
+ array insertion overhead for large input collections.
25
+ - Improved `IPAddr` lookup performance by converting its public integer
26
+ representation directly instead of allocating packed address strings.
27
+ - Avoided allocating a temporary candidate vector on parsed-path cache hits.
28
+
29
+ ### Changed
30
+
31
+ - Upgraded the `maxminddb` crate to 0.30.0, improving selective path decoding
32
+ and hardening iteration and verification of corrupt databases.
33
+ - Documented selective lookup and input-type performance guidance, and
34
+ clarified that thread-safe lookups remain serialized by MRI's global VM lock.
35
+ - Documented the file-lifecycle safety contract for memory-mapped readers and
36
+ the requirement to atomically replace database paths during updates.
37
+ - Simplified reader ownership by removing redundant outer `Arc` wrappers and a
38
+ duplicate closed flag while preserving atomic close semantics.
39
+ - Removed the redundant extension-level Cargo lockfile; workspace builds use
40
+ the root lockfile as the single dependency lock.
41
+ - Moved MMDB-to-Ruby decoding and string-cache logic into a focused Rust module.
42
+ - Moved metadata storage and Ruby method registration into a focused Rust
43
+ module.
44
+ - Moved parsed-path ownership, hashing, matching, and conversion into a focused
45
+ Rust module.
46
+ - Moved reader behavior and Ruby method registration into a focused Rust module,
47
+ leaving the crate root responsible only for extension initialization.
48
+ - Moved extension namespace and cache-root setup into a focused initialization
49
+ module.
50
+ - Alternated baseline and candidate subprocesses between benchmark samples to
51
+ reduce order and thermal bias in git-ref comparisons.
52
+ - Added fixed-record and prebuilt-`IPAddr` benchmark cases for cache-hot and
53
+ input-conversion performance comparisons.
54
+ - Extended allocation benchmarking to cover selective batch lookups.
55
+
56
+ ### Fixed
57
+
58
+ - Made decoded MMDB strings consistently frozen regardless of whether their
59
+ length qualifies for the bounded string cache.
60
+ - Decoded MMDB UTF-8 strings and map keys directly into Ruby strings from raw
61
+ bytes, avoiding unchecked Rust strings while preserving Ruby's behavior for
62
+ invalid UTF-8 in corrupt databases.
63
+ - Propagated Ruby hash insertion errors from `Metadata#description` instead of
64
+ silently returning a partial description.
65
+
8
66
  ## [0.5.0] - 2026-06-14
9
67
 
10
68
  ### Added
@@ -156,3 +214,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
156
214
 
157
215
  - MODE_FILE support (use MODE_MMAP instead)
158
216
  - File descriptor support in constructor
217
+
218
+ [0.6.0]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.5.0...v0.6.0
219
+ [0.5.0]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.4.0...v0.5.0
220
+ [0.4.0]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.3.0...v0.4.0
221
+ [0.3.0]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.2.1...v0.3.0
222
+ [0.2.1]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.2.0...v0.2.1
223
+ [0.2.0]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.1.4...v0.2.0
224
+ [0.1.4]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.1.3...v0.1.4
225
+ [0.1.3]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.1.2...v0.1.3
226
+ [0.1.2]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.1.1...v0.1.2
227
+ [0.1.1]: https://github.com/oschwald/maxmind-db-rust-ruby/compare/v0.1.0...v0.1.1
228
+ [0.1.0]: https://github.com/oschwald/maxmind-db-rust-ruby/releases/tag/v0.1.0
data/README.md CHANGED
@@ -102,6 +102,9 @@ iso_codes = reader.get_many_path(ips, ['country', 'iso_code'])
102
102
  reader.close
103
103
  ```
104
104
 
105
+ Decoded MMDB strings, including hash keys, are frozen. Call `dup` before
106
+ modifying a decoded string.
107
+
105
108
  ### Using IPAddr Objects
106
109
 
107
110
  ```ruby
@@ -153,6 +156,11 @@ reader = MaxMind::DB::Rust::Reader.new(
153
156
  )
154
157
  ```
155
158
 
159
+ `MODE_AUTO`, `MODE_FILE`, and `MODE_MMAP` require the underlying file not to be
160
+ modified or truncated while the reader is alive. To refresh a database, write
161
+ the replacement to a new file and atomically rename it over the old path. Use
162
+ `MODE_MEMORY` if the file lifecycle cannot be controlled this way.
163
+
156
164
  ### Accessing Metadata
157
165
 
158
166
  ```ruby
@@ -290,6 +298,18 @@ Get metadata about the database.
290
298
 
291
299
  **Returns:** `MaxMind::DB::Rust::Metadata` instance
292
300
 
301
+ #### `verify()`
302
+
303
+ Perform a comprehensive validation of the database metadata, search tree, data
304
+ section separator, and referenced data records. Verification traverses the
305
+ entire database and may use memory proportional to the number of distinct
306
+ referenced values, so it is intended for explicit integrity checks rather than
307
+ the lookup hot path.
308
+
309
+ **Returns:** `true` when the database passes verification
310
+
311
+ **Raises:** `MaxMind::DB::Rust::InvalidDatabaseError` when verification fails
312
+
293
313
  #### `close()`
294
314
 
295
315
  Close the database and release resources.
@@ -365,8 +385,16 @@ Lookup performance depends on hardware, Ruby version, database, and workload.
365
385
 
366
386
  - In this project’s random-lookup benchmarks, this gem is consistently faster than the official Ruby implementation.
367
387
  - `MODE_MMAP` and `MODE_MEMORY` both perform well; which is faster can vary by environment.
388
+ - Prefer `get_path` or `get_many_path` when only a small part of a record is
389
+ needed. Selective decoding avoids constructing the rest of the Ruby object
390
+ graph and can be substantially faster than a full-record lookup.
391
+ - Textual IP address strings use the fastest input path. `IPAddr` objects are
392
+ supported but require Ruby method calls to extract their address family and
393
+ integer value.
368
394
  - For current, reproducible numbers on your own data and Ruby version, run `benchmark/compare_lookups.rb` against your database.
369
- - Safe for concurrent lookups across threads.
395
+ - Readers are safe to share across Ruby threads. Ruby-facing lookup and decode
396
+ work currently runs under MRI's global VM lock, so additional Ruby threads do
397
+ not make one process perform lookups in parallel.
370
398
 
371
399
  ## Development
372
400
 
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maxmind-db-rust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Gregory Oschwald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-14 00:00:00.000000000 Z
11
+ date: 2026-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: parallel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "<"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement