pgtk 0.20.1 → 0.21.0

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: e94b2347f021d0eef4c02d7b577ed273746f50d86dfd3db1a1bbbf41760f1d13
4
- data.tar.gz: 414a7a9ea1d453e3a7dd8bf1d726a63b61c8c935a6a6c2cf397d68712029adfa
3
+ metadata.gz: e46e57835cc795fd4c73ef4016911c17cf3e088ddadda330f72a25efe56aa8c5
4
+ data.tar.gz: e921ed037a9b9ea1291513959bc73809fb615dac2e1f35a5f74d272514596396
5
5
  SHA512:
6
- metadata.gz: 03ca46751802f3c5b5d0c78c2a81738c1b04acb26ea44504d9892a35f8fc7136559e03e9c7f6c870399c86b0df83abc9cb0f88a7d299cf4380e117da5a86bf4e
7
- data.tar.gz: b6c4fed5e2a39f383250335efa8ea2a06f6914bcc4794405ff0f8f412523164bb65abb5c7bf2f07de89b02a8f7478563eb943605a1a8104951f672f3c084a536
6
+ metadata.gz: bdffbbdd4ee6e868ec6b61a7cc9d674f4ba17db9cf968b49fa6dbc3e6a92f9edc25d31f439fa30bbb3aab6a6d7ceac12a4b63e752bde38659f54dafa0ea2d67f
7
+ data.tar.gz: af7a104cffffd53bbdcb6a4a25666115fae8f0b5f312971a1244ce28030acdca11d673d244fb4303fcfe9594928e107ea69fc9070ebecc2e23f6d7533dbb4376
data/README.md CHANGED
@@ -116,7 +116,7 @@ From inside your app you may find this class useful:
116
116
  ```ruby
117
117
  require 'pgtk/pool'
118
118
  pgsql = Pgtk::Pool.new(Pgtk::Wire::Yaml.new('config.yml'))
119
- pgsql.start(5) # Start it with five simultaneous connections
119
+ pgsql.start!(5) # Start it with five simultaneous connections
120
120
  ```
121
121
 
122
122
  You can also let it pick the connection parameters from the environment
@@ -155,7 +155,8 @@ module Minitest
155
155
  def test_pgsql
156
156
  @@test_pgsql ||= Pgtk::Pool.new(
157
157
  Pgtk::Wire::Yaml.new('target/pgsql-config.yml')
158
- ).start
158
+ )
159
+ @@test_pgsql.start!
159
160
  end
160
161
  end
161
162
  end
@@ -19,7 +19,8 @@ require_relative '../pgtk'
19
19
  # Basic usage:
20
20
  #
21
21
  # # Create and configure a regular pool
22
- # pool = Pgtk::Pool.new(wire).start(4)
22
+ # pool = Pgtk::Pool.new(wire)
23
+ # pool.start!(4)
23
24
  #
24
25
  # # Wrap the pool in an impatient decorator with a 2-second timeout
25
26
  # impatient = Pgtk::Impatient.new(pool, 2)
@@ -67,6 +68,11 @@ class Pgtk::Impatient
67
68
  @off = off
68
69
  end
69
70
 
71
+ # Start a new connection pool with the given arguments.
72
+ def start!(*)
73
+ @pool.start!
74
+ end
75
+
70
76
  # Get the version of PostgreSQL server.
71
77
  #
72
78
  # @return [String] Version of PostgreSQL server
data/lib/pgtk/pool.rb CHANGED
@@ -29,7 +29,8 @@ require_relative 'wire'
29
29
  # )
30
30
  #
31
31
  # # Create and start a connection pool with 4 connections
32
- # pool = Pgtk::Pool.new(wire).start(4)
32
+ # pool = Pgtk::Pool.new(wire)
33
+ # pool.start!(4)
33
34
  #
34
35
  # # Execute a simple query
35
36
  # pool.exec('SELECT * FROM users')
@@ -85,12 +86,11 @@ class Pgtk::Pool
85
86
  # allows only one connection open.
86
87
  #
87
88
  # @param [Integer] max Total amount of PostgreSQL connections in the pool
88
- def start(max = 8)
89
+ def start!(max = 8)
89
90
  max.times do
90
91
  @pool << @wire.connection
91
92
  end
92
93
  @log.debug("PostgreSQL pool started with #{max} connections")
93
- self
94
94
  end
95
95
 
96
96
  # Make a query and return the result as an array of hashes. For example,
data/lib/pgtk/retry.rb CHANGED
@@ -16,7 +16,8 @@ require_relative '../pgtk'
16
16
  # Basic usage:
17
17
  #
18
18
  # # Create and configure a regular pool
19
- # pool = Pgtk::Pool.new(wire).start(4)
19
+ # pool = Pgtk::Pool.new(wire)
20
+ # pool.start!(4)
20
21
  #
21
22
  # # Wrap the pool in a retry decorator with 3 attempts
22
23
  # retry_pool = Pgtk::Retry.new(pool, attempts: 3)
data/lib/pgtk/spy.rb CHANGED
@@ -19,7 +19,8 @@ require_relative 'wire'
19
19
  # Basic usage:
20
20
  #
21
21
  # # Create and configure a regular pool
22
- # pool = Pgtk::Pool.new(wire).start(4)
22
+ # pool = Pgtk::Pool.new(wire)
23
+ # pool.start!(4)
23
24
  #
24
25
  # # Wrap the pool in a spy that tracks all executed queries
25
26
  # queries = []
@@ -55,6 +56,11 @@ class Pgtk::Spy
55
56
  @block = block
56
57
  end
57
58
 
59
+ # Start a new connection pool with the given arguments.
60
+ def start!(*)
61
+ @pool.start!
62
+ end
63
+
58
64
  # Get the version of PostgreSQL server.
59
65
  #
60
66
  # @return [String] Version of PostgreSQL server
data/lib/pgtk/stash.rb CHANGED
@@ -163,16 +163,9 @@ class Pgtk::Stash
163
163
  end
164
164
 
165
165
  # Start a new connection pool with the given arguments.
166
- # @return [Pgtk::Stash] A new stash that shares the same cache
167
- def start(*)
166
+ def start!(*)
168
167
  launch!
169
- Pgtk::Stash.new(
170
- @pool.start(*), @stash,
171
- refill_interval: @refill_interval,
172
- top: @top,
173
- threads: @threads,
174
- loog: @loog
175
- )
168
+ @pool.start!(*)
176
169
  end
177
170
 
178
171
  private
data/lib/pgtk/version.rb CHANGED
@@ -11,5 +11,5 @@ require_relative '../pgtk'
11
11
  # License:: MIT
12
12
  module Pgtk
13
13
  # Current version of the library.
14
- VERSION = '0.20.1'
14
+ VERSION = '0.21.0'
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko