ratomic 0.4.2 → 0.4.3

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: 764ab083a8815f4f2bd0958be83d5209b10b21d8765dc19720fedd6d042eec89
4
- data.tar.gz: 5bf02090ace17e0ca172bcc9f9f2a56f79030f0a92ecf669adecba72aa2ec641
3
+ metadata.gz: 73c8a9e8067cd54768d471f72fec834fbc4a865b70cb77ca784a2d4addace65a
4
+ data.tar.gz: 7e294ec44ad2e110f731aca962a5fe37f532e6f8d6f5d144e00fae575c347aa4
5
5
  SHA512:
6
- metadata.gz: c7a3e86bfe551b27b28af6655bd7853c1be683d69e759d6b628388282e7443030fe8b56c7e036e1c25f8234de74052fc621747eb94484e84e979b771aaf7ebcc
7
- data.tar.gz: 03e9c06d8c5771ab340e1219113b5f67c05da3e97c5ad2a5b7ddefb9e5b54103988eb6cb7c299e09a0808e27fec660b3eaea8a7a3fc200a5aa8dd84161faf484
6
+ metadata.gz: abf7be9f9209c28b97e2bce3d224cd9c269d2cd7675a4d987f5d3121240648799f29910a704e17fb01081152945acadfe7be4d08cdd3db7247d8ddaf1211372d
7
+ data.tar.gz: 04eb14597dbc79dfef40fa74f56440edb61028f6de591ccdc0d1a0abc0fb4a8072edc18547c3b69ced8a3df60ede050e503ed2f732d41ed37578b66d966851a6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## 0.4.3
4
+
5
+ ### Added
6
+
7
+ - Expose `Pool#size` and `LocalPool#size` and add `shutdown` aliases for connection pool compatibility.
8
+
3
9
  ## 0.4.2
4
10
 
5
11
  ### Fixed
@@ -69,6 +69,7 @@ module Ratomic
69
69
  # @see Pool Use Pool for plain mutable Ruby values where ownership transfer
70
70
  # is the desired safety model.
71
71
  class LocalPool
72
+ attr_reader :size
72
73
  # Create a per-Ractor local pool facade.
73
74
  #
74
75
  # @param size [Integer] maximum number of resources in each Ractor-local pool
@@ -127,6 +128,7 @@ module Ratomic
127
128
  pool.close
128
129
  nil
129
130
  end
131
+ alias_method :shutdown, :close
130
132
 
131
133
  # Minimal thread-safe resource pool used inside exactly one Ractor.
132
134
  class ResourcePool
data/lib/ratomic/pool.rb CHANGED
@@ -26,6 +26,7 @@ module Ratomic
26
26
  # buffer << :change
27
27
  # end
28
28
  class Pool
29
+ attr_reader :size
29
30
  # Create a pool and seed it with +size+ objects from the factory block.
30
31
  #
31
32
  # @param size [Integer] number of pooled objects to create up front
@@ -37,6 +38,7 @@ module Ratomic
37
38
  raise ArgumentError, "pool size must be positive" if size <= 0
38
39
  raise LocalJumpError, "no block given" unless block_given?
39
40
 
41
+ @size = size
40
42
  @timeout = timeout&.to_f
41
43
  @control = self.class.send(:new_control_ractor)
42
44
  size.times { @control.send([:checkin, yield], move: true) }
@@ -88,6 +90,8 @@ module Ratomic
88
90
  rescue Ractor::ClosedError, Ractor::Error
89
91
  nil
90
92
  end
93
+ # backwards compatibility with ConnectionPool
94
+ alias_method :shutdown, :close
91
95
 
92
96
  # Checkout an object, yield it, then move it back to the pool.
93
97
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Ratomic
4
4
  # Current gem version string.
5
- VERSION = "0.4.2"
5
+ VERSION = "0.4.3"
6
6
  end
data/sig/ratomic.rbs CHANGED
@@ -68,6 +68,8 @@ module Ratomic
68
68
 
69
69
  def with: () { (untyped object) -> untyped } -> untyped
70
70
  def close: () -> nil
71
+ def shutdown: () -> nil
72
+ def size: () -> Integer
71
73
  end
72
74
 
73
75
  class Pool
@@ -76,6 +78,8 @@ module Ratomic
76
78
  def checkout: () -> untyped
77
79
  def checkin: (untyped object) -> nil
78
80
  def close: () -> nil
81
+ def shutdown: () -> nil
82
+ def size: () -> Integer
79
83
  def with: () { (untyped object) -> untyped } -> untyped
80
84
  end
81
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratomic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham