lmdb 0.7.2 → 0.7.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 +4 -4
- data/lib/lmdb/database.rb +4 -20
- data/lib/lmdb/version.rb +1 -1
- data/spec/helper.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec26115e9cc3611f3305c308a5a26959e0f2ff6438c191968a562c85808fb6ed
|
|
4
|
+
data.tar.gz: 866b32d018335fa61dbefdc30234c976573a307ad11ae31c260a902cba6812e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0356608ed8065cb4065a752fff8e4aa657fc29c38630e45d278c7edcad4fd211f8129e87eba2e323f2f72a8751b6a43ead97501ece2c8a504cfc9eb0e3b0174c'
|
|
7
|
+
data.tar.gz: 7f1e02c62e406c108bd7db8875cf528c2ec43cca0beb2ab1ae6380a71b3054b74b66beddd98404e3de93de0928d9221aca9e73c6b309caa5734a0ef78d2d1313
|
data/lib/lmdb/database.rb
CHANGED
|
@@ -126,11 +126,8 @@ module LMDB
|
|
|
126
126
|
|
|
127
127
|
ret = false
|
|
128
128
|
# read-only txn was having trouble being nested inside a read-write
|
|
129
|
-
maybe_txn(true)
|
|
130
|
-
|
|
131
|
-
# env.transaction do
|
|
132
|
-
cursor { |c| ret = !!c.set(key, value) }
|
|
133
|
-
end
|
|
129
|
+
maybe_txn(true) { cursor { |c| ret = !!c.set(key, value) } }
|
|
130
|
+
|
|
134
131
|
ret
|
|
135
132
|
end
|
|
136
133
|
|
|
@@ -151,19 +148,13 @@ module LMDB
|
|
|
151
148
|
flags = { (dupsort? ? :nodupdata : :nooverwrite) => true }
|
|
152
149
|
|
|
153
150
|
env.transaction do |txn|
|
|
154
|
-
# begin
|
|
155
151
|
put(key, value, **options.merge(flags)) unless has?(key, value)
|
|
156
|
-
# rescue LMDB::Error::KEYEXIST
|
|
157
|
-
# # this should never be reached lol
|
|
158
|
-
# # warn 'lol'
|
|
159
|
-
# txn.abort
|
|
160
|
-
# nil
|
|
161
|
-
# end
|
|
162
152
|
end
|
|
163
153
|
end
|
|
164
154
|
|
|
165
155
|
# Delete the key (and optional value pair) if it exists; do not
|
|
166
156
|
# complain about missing keys.
|
|
157
|
+
#
|
|
167
158
|
# @param key [#to_s] The key of the record
|
|
168
159
|
# @param value [#to_s, nil] The optional value
|
|
169
160
|
#
|
|
@@ -172,14 +163,7 @@ module LMDB
|
|
|
172
163
|
# @return [void]
|
|
173
164
|
#
|
|
174
165
|
def delete?(key, value = nil)
|
|
175
|
-
env.transaction
|
|
176
|
-
begin
|
|
177
|
-
delete key, value
|
|
178
|
-
rescue LMDB::Error::NOTFOUND
|
|
179
|
-
txn.abort
|
|
180
|
-
nil
|
|
181
|
-
end
|
|
182
|
-
end
|
|
166
|
+
env.transaction { |txn| delete(key, value) if has?(key, value) }
|
|
183
167
|
end
|
|
184
168
|
|
|
185
169
|
# Return how many records there are in this database.
|
data/lib/lmdb/version.rb
CHANGED
data/spec/helper.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'lmdb'
|
|
2
2
|
require 'rspec'
|
|
3
3
|
require 'fileutils'
|
|
4
|
+
require 'tmpdir'
|
|
4
5
|
|
|
5
6
|
# for valgrind
|
|
6
7
|
at_exit { GC.start }
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
TEMP_ROOT = File.join(SPEC_ROOT, 'tmp')
|
|
9
|
+
TEMP_ROOT = File.join(Dir.tmpdir, 'lmdb-spec')
|
|
10
10
|
|
|
11
11
|
module LMDB::SpecHelper
|
|
12
12
|
def mkpath(name = 'env')
|