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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.md +7 -0
- data/lib/mdbx.rb +1 -1
- data/lib/mdbx/database.rb +39 -21
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e88f3e5ea2e66b7e924500a33f25f635c712e359bd0f8e19c52f60605bcafe46
|
4
|
+
data.tar.gz: c069a2b838b86f1cc9873613ad1b99c1f888f24eab395c9f264d830aa7ba810d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
205
|
-
|
206
|
-
|
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.
|
214
|
-
|
215
|
-
|
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.
|
265
|
-
|
266
|
-
|
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.
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
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.
|
287
|
-
|
288
|
-
|
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.
|
296
|
-
|
297
|
-
|
298
|
-
|
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
metadata.gz.sig
CHANGED
Binary file
|