mdbx 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7cc7a297e0f41d6caa23aa581bd11b1013a64a63ec6b04e9f07daae06f153d4
4
- data.tar.gz: b5a27168b461c29f88bbaf0c1fc45ec92f0fd121735ef483c76be66adef0750e
3
+ metadata.gz: e88f3e5ea2e66b7e924500a33f25f635c712e359bd0f8e19c52f60605bcafe46
4
+ data.tar.gz: c069a2b838b86f1cc9873613ad1b99c1f888f24eab395c9f264d830aa7ba810d
5
5
  SHA512:
6
- metadata.gz: ea27eb32cb736c4cc5d0a154d445e9c7e53966a219ab61bdca7fd4bb886538320e47f40fb9d91569b14b0d6aacf69e0dcab045c5ba5c51416231e5abde8326cd
7
- data.tar.gz: 0b5496433f6854926f90edc33aeccf9aba653fd76c6db6903ef1d5d95bbafca538957417eba1a90ee087f09faebc2df11eab0e6ceabb67846428ecc8635776c7
6
+ metadata.gz: 6d575ad77ff4c72382d13852d0d075c8b8caa664f8e55ace63e0e638695cd2cff43d2580484abff76fce0cf4efa60b8423d4330d65d1a1f39da07c8cd93ea7e9
7
+ data.tar.gz: 895d6aee64d76e6e2b62071ae7d1cc98aa4d692d2b377c0d04e6f9f5ebb7495f23db7dafa66c8a2cdaf6a9a1925f003fca6d02e4646e4a23bf415167050dc0b4
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Release History for MDBX
2
2
 
3
3
  ---
4
+ ## v0.1.1 [2021-03-14] Mahlon E. Smith <mahlon@martini.nu>
5
+
6
+ Bugfix:
7
+
8
+ - Don't inadvertantly close an open transaction while using hash convenience methods.
9
+
10
+
4
11
  ## v0.1.0 [2021-03-14] Mahlon E. Smith <mahlon@martini.nu>
5
12
 
6
13
  Initial public release.
data/lib/mdbx.rb CHANGED
@@ -10,7 +10,7 @@ require 'mdbx_ext'
10
10
  module MDBX
11
11
 
12
12
  # The version of this gem.
13
- VERSION = '0.1.0'
13
+ VERSION = '0.1.1'
14
14
 
15
15
  end # module MDBX
16
16
 
data/lib/mdbx/database.rb CHANGED
@@ -201,18 +201,24 @@ class MDBX::Database
201
201
  ### pairs.
202
202
  ###
203
203
  def to_a
204
- self.snapshot do
205
- return self.each_pair.to_a
206
- end
204
+ in_txn = self.in_transaction?
205
+ self.snapshot unless in_txn
206
+
207
+ return self.each_pair.to_a
208
+ ensure
209
+ self.abort unless in_txn
207
210
  end
208
211
 
209
212
 
210
213
  ### Return the entirety of database contents as a Hash.
211
214
  ###
212
215
  def to_h
213
- self.snapshot do
214
- return self.each_pair.to_h
215
- end
216
+ in_txn = self.in_transaction?
217
+ self.snapshot unless in_txn
218
+
219
+ return self.each_pair.to_h
220
+ ensure
221
+ self.abort unless in_txn
216
222
  end
217
223
 
218
224
 
@@ -261,9 +267,12 @@ class MDBX::Database
261
267
  ### Returns a new Array containing all keys in the collection.
262
268
  ###
263
269
  def keys
264
- self.snapshot do
265
- return self.each_key.to_a
266
- end
270
+ in_txn = self.in_transaction?
271
+ self.snapshot unless in_txn
272
+
273
+ return self.each_key.to_a
274
+ ensure
275
+ self.abort unless in_txn
267
276
  end
268
277
 
269
278
 
@@ -271,32 +280,41 @@ class MDBX::Database
271
280
  ### keys. Any given keys that are not found are ignored.
272
281
  ###
273
282
  def slice( *keys )
274
- self.snapshot do
275
- return keys.each_with_object( {} ) do |key, acc|
276
- val = self[ key ]
277
- acc[ key ] = val if val
278
- end
283
+ in_txn = self.in_transaction?
284
+ self.snapshot unless in_txn
285
+
286
+ return keys.each_with_object( {} ) do |key, acc|
287
+ val = self[ key ]
288
+ acc[ key ] = val if val
279
289
  end
290
+ ensure
291
+ self.abort unless in_txn
280
292
  end
281
293
 
282
294
 
283
295
  ### Returns a new Array containing all values in the collection.
284
296
  ###
285
297
  def values
286
- self.snapshot do
287
- return self.each_value.to_a
288
- end
298
+ in_txn = self.in_transaction?
299
+ self.snapshot unless in_txn
300
+
301
+ return self.each_value.to_a
302
+ ensure
303
+ self.abort unless in_txn
289
304
  end
290
305
 
291
306
 
292
307
  ### Returns a new Array containing values for the given +keys+.
293
308
  ###
294
309
  def values_at( *keys )
295
- self.snapshot do
296
- return keys.each_with_object( [] ) do |key, acc|
297
- acc << self[ key ]
298
- end
310
+ in_txn = self.in_transaction?
311
+ self.snapshot unless in_txn
312
+
313
+ return keys.each_with_object( [] ) do |key, acc|
314
+ acc << self[ key ]
299
315
  end
316
+ ensure
317
+ self.abort unless in_txn
300
318
  end
301
319
 
302
320
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdbx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mahlon E. Smith
metadata.gz.sig CHANGED
Binary file