lmdb 0.5.3 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTORS +1 -0
- data/Rakefile +9 -0
- data/behaviour.org +35 -0
- data/ext/lmdb_ext/extconf.rb +8 -3
- data/ext/lmdb_ext/lmdb_ext.c +314 -200
- data/ext/lmdb_ext/lmdb_ext.h +19 -3
- data/lib/lmdb/database.rb +9 -8
- data/lib/lmdb/version.rb +1 -1
- data/lmdb.gemspec +5 -4
- data/spec/helper.rb +3 -0
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/.gitignore +8 -0
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/COPYRIGHT +1 -1
- data/vendor/libraries/liblmdb/Doxyfile +1631 -0
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/LICENSE +0 -0
- data/vendor/libraries/liblmdb/Makefile +118 -0
- data/vendor/libraries/liblmdb/intro.doc +192 -0
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/lmdb.h +161 -61
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/mdb.c +3244 -1302
- data/vendor/libraries/liblmdb/mdb_copy.1 +61 -0
- data/vendor/libraries/liblmdb/mdb_copy.c +84 -0
- data/vendor/libraries/liblmdb/mdb_drop.1 +40 -0
- data/vendor/libraries/liblmdb/mdb_drop.c +135 -0
- data/vendor/libraries/liblmdb/mdb_dump.1 +81 -0
- data/vendor/libraries/liblmdb/mdb_dump.c +319 -0
- data/vendor/libraries/liblmdb/mdb_load.1 +84 -0
- data/vendor/libraries/liblmdb/mdb_load.c +492 -0
- data/vendor/libraries/liblmdb/mdb_stat.1 +70 -0
- data/vendor/libraries/liblmdb/mdb_stat.c +264 -0
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/midl.c +66 -5
- data/{ext/lmdb_ext → vendor/libraries}/liblmdb/midl.h +19 -5
- data/vendor/libraries/liblmdb/mtest.c +177 -0
- data/vendor/libraries/liblmdb/mtest2.c +124 -0
- data/vendor/libraries/liblmdb/mtest3.c +133 -0
- data/vendor/libraries/liblmdb/mtest4.c +168 -0
- data/vendor/libraries/liblmdb/mtest5.c +135 -0
- data/vendor/libraries/liblmdb/mtest6.c +141 -0
- data/vendor/libraries/liblmdb/sample-bdb.txt +73 -0
- data/vendor/libraries/liblmdb/sample-mdb.txt +62 -0
- data/vendor/libraries/liblmdb/tooltag +27 -0
- metadata +53 -18
- data/.gitignore +0 -13
- data/.travis.yml +0 -14
- data/ext/lmdb_ext/liblmdb/CHANGES +0 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6f0a0943419dca02f5aab8971d28fe32b5771842cbfcb467e6f6c4b368aae4f
|
4
|
+
data.tar.gz: 5cd32d2a3b594861d92cfd9dcdd71aed3534b2ea7c4d910b3ce02e07dbb2ba02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 340922f5163f227adffd8ef78dfd7348ad159f86df16fb469e18d92a1f04b08a5769c867d03fe6610e291375fb8c515e86847f171db2552262338b91327eaa03
|
7
|
+
data.tar.gz: c99c4423232109007ac971ec2d268ea4642751f0d4bcda3aa91c69c9348371d88e0612439fd583f07ef3d5165d7fd384ffc85c3674cf2d372d559aa3dfdccabe
|
data/CONTRIBUTORS
CHANGED
data/Rakefile
CHANGED
@@ -7,12 +7,21 @@ PRJ = File.basename(GEMSPEC, ".gemspec")
|
|
7
7
|
require 'bundler/setup'
|
8
8
|
require 'rspec/core/rake_task'
|
9
9
|
require 'rake/extensiontask'
|
10
|
+
require 'ruby_memcheck'
|
11
|
+
require 'ruby_memcheck/rspec/rake_task'
|
12
|
+
|
13
|
+
RubyMemcheck.config(binary_name: 'lmdb_ext')
|
10
14
|
|
11
15
|
RSpec::Core::RakeTask.new :spec
|
12
16
|
Rake::ExtensionTask.new :lmdb_ext
|
13
17
|
|
18
|
+
|
14
19
|
task :default => [:compile, :spec]
|
15
20
|
|
21
|
+
namespace :spec do
|
22
|
+
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
|
23
|
+
end
|
24
|
+
|
16
25
|
def version
|
17
26
|
@version ||= begin
|
18
27
|
require "#{PRJ}/version"
|
data/behaviour.org
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#+STARTUP: showall hidestars
|
2
|
+
* the situtation
|
3
|
+
- lmdb has two kinds of transaction: read-write and read-only
|
4
|
+
- there are two properties associated with transactions:
|
5
|
+
- nesting
|
6
|
+
- multiplicity
|
7
|
+
- *read-write* transactions can nest, but there can only be one stack of read-write transactions per *database*, that is, amongst /all/ threads and all processes attached to the persitent storage.
|
8
|
+
- *read-only* transactions /cannot/ nest (because it's not meaningful for a read-only transaction to nest), but there can be a read-only transaction per thread (and of course multiple threads per process).
|
9
|
+
- (i can't remember if you can have a thread with a read-write *and* read-only transaction going but we can probably assume not)
|
10
|
+
- so therefore we need a way to distinguish between read-write and read-only as well as identify the thread /across processes/ that has the one read-write transaction open.
|
11
|
+
* undocumented behaviour
|
12
|
+
** ~mdb_txn_begin~
|
13
|
+
- if the environment is read-only and the transaction is read-write, returns ~EACCES~
|
14
|
+
- if there is a parent transaction and the current transaction's flags are ~MDB_RDONLY~ or ~MDB_WRITEMAP~ (?) or ~TXN_BLOCKED~
|
15
|
+
- if the *parent's* transaction is ~MDB_TXN_RDONLY~ (which is the same as ~MDB_RDONLY~), return ~EINVAL~
|
16
|
+
- that's saying "read-only transactions can't be nested"
|
17
|
+
- otherwise, return ~MDB_BAD_TXN~
|
18
|
+
- this is saying "read-only transactions can't be children of read-write parents"
|
19
|
+
- otherwise a few boring scenarios where the function may return ~ENOMEM~
|
20
|
+
- otherwise check ~mdb_cursor_shadow~ or ~mdb_txn_renew0~
|
21
|
+
- XXX does ~mdb_txn_begin~ block when waiting for the read-write??
|
22
|
+
* desired behaviour
|
23
|
+
** ruby interface
|
24
|
+
- when the ruby programmer opens a read-only transaction within a read-only transaction, this should be a noop
|
25
|
+
- don't push any stack, don't allocate any resources, just do nothing
|
26
|
+
- when the ruby programmer opens a read-only transaction within a read-/write/ transaction, this should raise an exception
|
27
|
+
- in practice there's no harm except that this is more about communicating the right thing to the ruby programmer
|
28
|
+
- do we warn?
|
29
|
+
- problem: there's no way to know (via the lmdb api) if another process has a read-write transaction open
|
30
|
+
- poll?
|
31
|
+
- actually no it probably doesn't matter (the mdb api blocks anyway?)
|
32
|
+
- /actually/ actually, the cursed-ass goto pseudo-loop containing the ~CALL_WITHOUT_GVL~ deals with that
|
33
|
+
** internal implementation
|
34
|
+
- a successfully-created read-write transaction has to set ~rw_txn_thread~ to the current thread (unless it is a sub-transaction in which case noop)
|
35
|
+
- when a read-write transaction is committed or aborted, ~rw_txn_thread~ has to be set back to null (unless the transaction has a parent)
|
data/ext/lmdb_ext/extconf.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
3
|
$CFLAGS = '-std=c99 -Wall -g'
|
4
|
+
$CFLAGS << ' -fdeclspec' if /darwin/.match? RUBY_PLATFORM
|
4
5
|
|
5
6
|
# Embed lmdb if we cannot find it
|
6
7
|
if enable_config("bundled-lmdb", false) || !(find_header('lmdb.h') && have_library('lmdb', 'mdb_env_create'))
|
7
|
-
|
8
|
+
lmdbpath = "../../vendor/libraries/liblmdb"
|
9
|
+
$INCFLAGS << " -I$(srcdir)/#{lmdbpath}"
|
8
10
|
$VPATH ||= []
|
9
|
-
$VPATH << "$(srcdir)
|
10
|
-
|
11
|
+
$VPATH << "$(srcdir)/#{lmdbpath}"
|
12
|
+
# XXX this is a sketchy, sketchy way to do this
|
13
|
+
$srcs = Dir.glob("#{$srcdir}/{#{lmdbpath}/{mdb,midl}.c,*.c}").map do |n|
|
14
|
+
File.basename(n)
|
15
|
+
end
|
11
16
|
end
|
12
17
|
|
13
18
|
have_header 'limits.h'
|