probabilistic_machines 0.1.1 → 0.1.2

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: 8c5cfb3b4e94463e5c61a5a8181c1bd713d0135b87839176d55b1a4ac9ed1fe9
4
- data.tar.gz: a086f4a5d9cc1505c740bd4fb7be35b84283fae0fbbc5888e04ad44d0333ced9
3
+ metadata.gz: a0ba466616d31d7c063936a4ee5ce93e2e0fcf210ffb8f2666603e267d3d668a
4
+ data.tar.gz: 69aec066a74468805de0d73927e868b033a84d6d6d4e1ab026b4e045504cb739
5
5
  SHA512:
6
- metadata.gz: 2619d85be86268533cc95d101d332ceb71e50139a24487d1fecb9f281d501a511fda27bdb9191e865b5a1dae265faa80f2e632bb5b1a5586a9817f7a817d85e2
7
- data.tar.gz: 73164970f1cfa50eb8a1a976eddff1e053865af8f122393bcdd4b5cf8db133c1360ea03b09407d457a8bf245bf85685206962c70821f3e63e5d6493088a7b943
6
+ metadata.gz: 567247a350e6bc5647d4e669273cbb7272d8247be519c8f1b437f45a5798e7194e876095e6d7ad80a626b8ed444c2dc4888c77fadca43d0ad73717ca15479e9c
7
+ data.tar.gz: 56f3e5c29459775c205669a86ef94d6b160fa43bd2d09ad95310aaea9244961f1e7a97e5db6d74c32b5922b8dc92f9305108fb74719395840952d67f13da95ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.2](https://github.com/seuros/probabilistic_machines/compare/probabilistic_machines/v0.1.1...probabilistic_machines/v0.1.2) (2026-11-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * accept any cloneable key in HeavyHitters ([108ed8c](https://github.com/seuros/probabilistic_machines/commit/108ed8c79adeffeef708aa298baa7cc64d55d12b))
9
+ * pass a rubygems OTP through the environment ([7a6cc44](https://github.com/seuros/probabilistic_machines/commit/7a6cc446dc737f44e46c4e41b0a76d1fc9b7f5cc))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * a republished platform gem is skipped, not fatal ([6210171](https://github.com/seuros/probabilistic_machines/commit/6210171a4ae679293d9cc6cfbdd82a9d99611a6e))
15
+ * collect the built gems whatever depth the download puts them at ([b377177](https://github.com/seuros/probabilistic_machines/commit/b377177879e2a922184eb3e5f9965e8f8c806f00))
16
+ * the release tag carries the gem name, and the gate uses the aggregate output ([9b949b4](https://github.com/seuros/probabilistic_machines/commit/9b949b4dc257b4251ff7c8806d6c8efdb05ac26d))
17
+
3
18
  ## [0.1.1](https://github.com/seuros/probabilistic_machines/compare/probabilistic_machines-v0.1.0...probabilistic_machines/v0.1.1) (2026-11-01)
4
19
 
5
20
 
data/Cargo.lock CHANGED
@@ -158,11 +158,11 @@ dependencies = [
158
158
 
159
159
  [[package]]
160
160
  name = "probabilistic-machines"
161
- version = "0.2.0"
161
+ version = "0.3.0"
162
162
 
163
163
  [[package]]
164
164
  name = "probabilistic_machines_native"
165
- version = "0.1.1"
165
+ version = "0.1.2"
166
166
  dependencies = [
167
167
  "bytes",
168
168
  "magnus",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "probabilistic-machines"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  edition.workspace = true
5
5
  rust-version.workspace = true
6
6
  authors = ["Abdelkader Boudih <oss@seuros.com>"]
@@ -28,6 +28,13 @@ pub struct Hitter<T> {
28
28
  /// insertions scan all `K` counters, which is the trade for needing no heap and
29
29
  /// no key ordering: keep `K` in the dozens-to-hundreds range.
30
30
  ///
31
+ /// A key need only be [`Clone`] and [`Eq`], so owned keys work directly:
32
+ /// `HeavyHitters<String, 64>` tracks layer names without interning them first.
33
+ /// Cloning happens on insert and on [`merge`](Self::merge), never on a lookup,
34
+ /// so a cheap key is worth having but a `String` is not a mistake. Interning to
35
+ /// a `u32` id, or hashing with [`hash64`](crate::hash64) the way the Ruby
36
+ /// binding does, keeps the table [`Copy`] and the scan cache-friendly.
37
+ ///
31
38
  /// ```
32
39
  /// use probabilistic_machines::HeavyHitters;
33
40
  ///
@@ -48,7 +55,7 @@ pub struct HeavyHitters<T, const K: usize> {
48
55
  observed: u64,
49
56
  }
50
57
 
51
- impl<T: Copy + Eq, const K: usize> HeavyHitters<T, K> {
58
+ impl<T: Clone + Eq, const K: usize> HeavyHitters<T, K> {
52
59
  #[must_use]
53
60
  pub const fn new() -> Self {
54
61
  Self {
@@ -116,7 +123,7 @@ impl<T: Copy + Eq, const K: usize> HeavyHitters<T, K> {
116
123
  }
117
124
  }
118
125
  for hitter in other.hitters() {
119
- self.absorb(hitter.key, hitter.count, hitter.overestimate);
126
+ self.absorb(hitter.key.clone(), hitter.count, hitter.overestimate);
120
127
  }
121
128
  self.observed = self.observed.saturating_add(other.observed);
122
129
  }
@@ -304,18 +311,18 @@ fn records_are_coherent(records: &[[u8; RECORD_LEN]], observed: u64) -> bool {
304
311
  })
305
312
  }
306
313
 
307
- impl<T: Copy + Eq, const K: usize> Default for HeavyHitters<T, K> {
314
+ impl<T: Clone + Eq, const K: usize> Default for HeavyHitters<T, K> {
308
315
  fn default() -> Self {
309
316
  Self::new()
310
317
  }
311
318
  }
312
319
 
313
320
  #[cfg(feature = "alloc")]
314
- impl<T: Copy + Eq, const K: usize> HeavyHitters<T, K> {
321
+ impl<T: Clone + Eq, const K: usize> HeavyHitters<T, K> {
315
322
  /// Tracked keys, most frequent first.
316
323
  #[must_use]
317
324
  pub fn ranked(&self) -> alloc::vec::Vec<Hitter<T>> {
318
- let mut ranked: alloc::vec::Vec<Hitter<T>> = self.hitters().copied().collect();
325
+ let mut ranked: alloc::vec::Vec<Hitter<T>> = self.hitters().cloned().collect();
319
326
  ranked.sort_unstable_by_key(|hitter| core::cmp::Reverse(hitter.count));
320
327
  ranked
321
328
  }
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "probabilistic_machines_native"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  edition.workspace = true
5
5
  rust-version.workspace = true
6
6
  authors = ["Abdelkader Boudih <oss@seuros.com>"]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProbabilisticMachines
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: probabilistic_machines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih