pgtk 0.20.1 → 0.21.1

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: 7aafa6855949c2d53a9dbe211ea2fa398127195d82f295885ca1c2bea3f44c6d
4
+ data.tar.gz: 2b667ab6b48c439342897bde8ff23eaa43123ca1ca343bb742f9cef91282aeaf
5
5
  SHA512:
6
- metadata.gz: 03ca46751802f3c5b5d0c78c2a81738c1b04acb26ea44504d9892a35f8fc7136559e03e9c7f6c870399c86b0df83abc9cb0f88a7d299cf4380e117da5a86bf4e
7
- data.tar.gz: b6c4fed5e2a39f383250335efa8ea2a06f6914bcc4794405ff0f8f412523164bb65abb5c7bf2f07de89b02a8f7478563eb943605a1a8104951f672f3c084a536
6
+ metadata.gz: a2d6cd764921a72746bc2f7128d90f0a63e9d526a06950a03f5f8937da2c0384bd5956245dce3eaa40db91f85089c492dec8bc2c6c48e9d516ddeec9deff4779
7
+ data.tar.gz: 3c34258ea93eb76b81813c3d1702d46d1df9843cda66bf58f7b5b53e6034ada597630c778efb54d3efa09c0aa9693992ca4d723a57097ca9d843026fa92605ff
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)
@@ -56,6 +57,11 @@ class Pgtk::Retry
56
57
  @attempts = attempts
57
58
  end
58
59
 
60
+ # Start a new connection pool with the given arguments.
61
+ def start!(*)
62
+ @pool.start!(*)
63
+ end
64
+
59
65
  # Get the version of PostgreSQL server.
60
66
  #
61
67
  # @return [String] Version of PostgreSQL server
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
@@ -66,6 +66,12 @@ class Pgtk::Stash
66
66
  @loog = loog
67
67
  end
68
68
 
69
+ # Start a new connection pool with the given arguments.
70
+ def start!(*)
71
+ launch!
72
+ @pool.start!(*)
73
+ end
74
+
69
75
  # Get the PostgreSQL server version.
70
76
  # @return [String] Version string of the database server
71
77
  def version
@@ -162,19 +168,6 @@ class Pgtk::Stash
162
168
  end
163
169
  end
164
170
 
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(*)
168
- launch!
169
- Pgtk::Stash.new(
170
- @pool.start(*), @stash,
171
- refill_interval: @refill_interval,
172
- top: @top,
173
- threads: @threads,
174
- loog: @loog
175
- )
176
- end
177
-
178
171
  private
179
172
 
180
173
  def launch!
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.1'
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko