lmdb 0.6.2 → 0.6.4
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/README.md +1 -2
- data/ext/lmdb_ext/extconf.rb +1 -1
- data/ext/lmdb_ext/lmdb_ext.c +16 -4
- data/lib/lmdb/database.rb +4 -0
- data/lib/lmdb/version.rb +1 -1
- data/lmdb.gemspec +1 -1
- data/spec/lmdb_spec.rb +16 -0
- metadata +5 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bef8556fe013707e1253bff4b1e2638517fb39a5de3fb33b1c0766a17e55597
|
4
|
+
data.tar.gz: 434ea5d0333c4b51851f2917a46d0f830bd080c2924812d9376e5baabdf00b30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ec8737a301c0abdc06421291a2dc0afef6ed112c96bd403e63e64f5046178599edf13053c03ce09b937fa87f922056d7e8fdccc651052d6cb967999d36e0e2
|
7
|
+
data.tar.gz: f1f78664147747397102e76c7a84ba938a28e3888bd4a52ecf46f7bb2c8a6cdbbfe3adadbe0108f63ec9885ff80cbcccc9ab5f8fb9411033448f4fba17b36fe1
|
data/README.md
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
[](https://www.gittip.com/min4d/ "Donate weekly to this project using Gittip")
|
4
4
|
[](https://flattr.com/submit/auto?user_id=min4d&url=https://github.com/minad/lmdb&title=LMDB&language=&tags=github&category=software)
|
5
5
|
|
6
|
-
Ruby bindings for the amazing OpenLDAP's Lightning Memory-Mapped Database (LMDB)
|
7
|
-
http://symas.com/mdb/
|
6
|
+
Ruby bindings for the amazing [OpenLDAP's Lightning Memory-Mapped Database (LMDB)](https://www.symas.com/lmdb/).
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
data/ext/lmdb_ext/extconf.rb
CHANGED
data/ext/lmdb_ext/lmdb_ext.c
CHANGED
@@ -248,7 +248,7 @@ static void stop_txn_begin(void *arg)
|
|
248
248
|
|
249
249
|
/**
|
250
250
|
* This is the code that opens transactions. Read-write transactions
|
251
|
-
* have to be called outside the GVL because they will block
|
251
|
+
* have to be called outside the GVL because they will block otherwise.
|
252
252
|
*
|
253
253
|
*
|
254
254
|
* Here is the basic problem with LMDB transactions:
|
@@ -1360,13 +1360,25 @@ static VALUE cursor_next_range(VALUE self, VALUE upper_bound_key) {
|
|
1360
1360
|
|
1361
1361
|
rb_scan_args(argc, argv, "11", &vkey, &vval);
|
1362
1362
|
|
1363
|
+
/*
|
1364
|
+
XXX TODO: this was a nasty segfault: the key (and any
|
1365
|
+
non-nil value) should be asserted to be strings, but then
|
1366
|
+
if the database is `integerkeys` then perhaps we should coerce?
|
1367
|
+
*/
|
1368
|
+
|
1369
|
+
if (TYPE(vkey) != T_STRING)
|
1370
|
+
rb_raise(rb_eArgError, "key must be a string");
|
1371
|
+
|
1363
1372
|
key.mv_size = RSTRING_LEN(vkey);
|
1364
1373
|
key.mv_data = StringValuePtr(vkey);
|
1365
1374
|
|
1366
1375
|
if (!NIL_P(vval)) {
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1376
|
+
if (TYPE(vval) != T_STRING)
|
1377
|
+
rb_raise(rb_eArgError, "non-nil value must be a string");
|
1378
|
+
|
1379
|
+
op = MDB_GET_BOTH;
|
1380
|
+
value.mv_size = RSTRING_LEN(vval);
|
1381
|
+
value.mv_data = StringValuePtr(vval);
|
1370
1382
|
}
|
1371
1383
|
|
1372
1384
|
ret = mdb_cursor_get(cursor->cur, &key, &value, op);
|
data/lib/lmdb/database.rb
CHANGED
@@ -122,6 +122,8 @@ module LMDB
|
|
122
122
|
return true if value.nil? or value.to_s == v
|
123
123
|
return false unless dupsort?
|
124
124
|
|
125
|
+
# warn "checking dupsort value `#{value.inspect}` (#{value.class})"
|
126
|
+
|
125
127
|
ret = false
|
126
128
|
# read-only txn was having trouble being nested inside a read-write
|
127
129
|
maybe_txn true do
|
@@ -152,9 +154,11 @@ module LMDB
|
|
152
154
|
# going to do this (djt; 2020-02-10)
|
153
155
|
def maybe_txn(readonly, &block)
|
154
156
|
if t = env.active_txn
|
157
|
+
# warn "reusing #{t.readonly? ? 'read-only ' : ''}txn #{t.inspect}"
|
155
158
|
yield t
|
156
159
|
else
|
157
160
|
env.transaction !!readonly do |t|
|
161
|
+
# warn "new #{t.readonly? ? 'read-only ' : ''}txn #{t.inspect}"
|
158
162
|
yield t
|
159
163
|
end
|
160
164
|
end
|
data/lib/lmdb/version.rb
CHANGED
data/lmdb.gemspec
CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency 'rake', '~> 13'
|
26
26
|
s.add_development_dependency 'rake-compiler', '~> 1.2'
|
27
27
|
s.add_development_dependency 'rspec', '~> 3'
|
28
|
-
s.add_development_dependency 'ruby_memcheck', '~>
|
28
|
+
s.add_development_dependency 'ruby_memcheck', '~> 3'
|
29
29
|
end
|
data/spec/lmdb_spec.rb
CHANGED
@@ -418,5 +418,21 @@ describe LMDB do
|
|
418
418
|
db.put 'hurr', 'durr' unless db.has? 'hurr', 'durr'
|
419
419
|
end
|
420
420
|
end
|
421
|
+
|
422
|
+
it 'should croak when cursor key is not given a string' do
|
423
|
+
proc do
|
424
|
+
db.cursor do |c|
|
425
|
+
c.set 1
|
426
|
+
end
|
427
|
+
end.should raise_error(ArgumentError)
|
428
|
+
end
|
429
|
+
|
430
|
+
it 'should croak when cursor value is not given a string' do
|
431
|
+
proc do
|
432
|
+
db.cursor do |c|
|
433
|
+
c.set 'hi', 1
|
434
|
+
end
|
435
|
+
end.should raise_error(ArgumentError)
|
436
|
+
end
|
421
437
|
end
|
422
438
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lmdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
8
8
|
- Dorian Taylor
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-05-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
@@ -59,14 +58,14 @@ dependencies:
|
|
59
58
|
requirements:
|
60
59
|
- - "~>"
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
61
|
+
version: '3'
|
63
62
|
type: :development
|
64
63
|
prerelease: false
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
66
|
- - "~>"
|
68
67
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
68
|
+
version: '3'
|
70
69
|
description: lmdb is a Ruby binding to OpenLDAP Lightning MDB.
|
71
70
|
email: code@doriantaylor.com
|
72
71
|
executables: []
|
@@ -130,7 +129,6 @@ homepage: https://github.com/doriantaylor/rb-lmdb
|
|
130
129
|
licenses:
|
131
130
|
- MIT
|
132
131
|
metadata: {}
|
133
|
-
post_install_message:
|
134
132
|
rdoc_options: []
|
135
133
|
require_paths:
|
136
134
|
- lib
|
@@ -145,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
143
|
- !ruby/object:Gem::Version
|
146
144
|
version: '0'
|
147
145
|
requirements: []
|
148
|
-
rubygems_version: 3.3
|
149
|
-
signing_key:
|
146
|
+
rubygems_version: 3.6.3
|
150
147
|
specification_version: 4
|
151
148
|
summary: Ruby bindings to Lightning MDB
|
152
149
|
test_files:
|