lmdb 0.5.3 → 0.6.1

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTORS +1 -0
  3. data/Rakefile +9 -0
  4. data/behaviour.org +35 -0
  5. data/ext/lmdb_ext/extconf.rb +8 -3
  6. data/ext/lmdb_ext/lmdb_ext.c +314 -200
  7. data/ext/lmdb_ext/lmdb_ext.h +19 -3
  8. data/lib/lmdb/database.rb +9 -8
  9. data/lib/lmdb/version.rb +1 -1
  10. data/lmdb.gemspec +5 -4
  11. data/spec/helper.rb +3 -0
  12. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/.gitignore +8 -0
  13. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/COPYRIGHT +1 -1
  14. data/vendor/libraries/liblmdb/Doxyfile +1631 -0
  15. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/LICENSE +0 -0
  16. data/vendor/libraries/liblmdb/Makefile +118 -0
  17. data/vendor/libraries/liblmdb/intro.doc +192 -0
  18. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/lmdb.h +161 -61
  19. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/mdb.c +3244 -1302
  20. data/vendor/libraries/liblmdb/mdb_copy.1 +61 -0
  21. data/vendor/libraries/liblmdb/mdb_copy.c +84 -0
  22. data/vendor/libraries/liblmdb/mdb_drop.1 +40 -0
  23. data/vendor/libraries/liblmdb/mdb_drop.c +135 -0
  24. data/vendor/libraries/liblmdb/mdb_dump.1 +81 -0
  25. data/vendor/libraries/liblmdb/mdb_dump.c +319 -0
  26. data/vendor/libraries/liblmdb/mdb_load.1 +84 -0
  27. data/vendor/libraries/liblmdb/mdb_load.c +492 -0
  28. data/vendor/libraries/liblmdb/mdb_stat.1 +70 -0
  29. data/vendor/libraries/liblmdb/mdb_stat.c +264 -0
  30. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/midl.c +66 -5
  31. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/midl.h +19 -5
  32. data/vendor/libraries/liblmdb/mtest.c +177 -0
  33. data/vendor/libraries/liblmdb/mtest2.c +124 -0
  34. data/vendor/libraries/liblmdb/mtest3.c +133 -0
  35. data/vendor/libraries/liblmdb/mtest4.c +168 -0
  36. data/vendor/libraries/liblmdb/mtest5.c +135 -0
  37. data/vendor/libraries/liblmdb/mtest6.c +141 -0
  38. data/vendor/libraries/liblmdb/sample-bdb.txt +73 -0
  39. data/vendor/libraries/liblmdb/sample-mdb.txt +62 -0
  40. data/vendor/libraries/liblmdb/tooltag +27 -0
  41. metadata +53 -18
  42. data/.gitignore +0 -13
  43. data/.travis.yml +0 -14
  44. data/ext/lmdb_ext/liblmdb/CHANGES +0 -112
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c02c1c99b143e331bf5fdbae711a57c4845b32ca07c4c041c9c639b96cbb8388
4
- data.tar.gz: ce305105acf85f4161e654dc80ad045baeded4e8a8e39f45fed9f8da68f5c2ce
3
+ metadata.gz: d6f0a0943419dca02f5aab8971d28fe32b5771842cbfcb467e6f6c4b368aae4f
4
+ data.tar.gz: 5cd32d2a3b594861d92cfd9dcdd71aed3534b2ea7c4d910b3ce02e07dbb2ba02
5
5
  SHA512:
6
- metadata.gz: 1303411d1515bf39a6406540f3a10d9e12c2bd3fea597d17a9e2b949bcf7707244381467a624edd15fada41ac65ae87721c2e42a9ec4dadb5b37e9f8db2a55b0
7
- data.tar.gz: aeaa5861dcbde41e9fec9634f6cae749dce6a1348ab9541f90247c2cff60dcb10180701348757a00ba7fc11e93431ef97cfb3064e5face3cc50c704498ca183d
6
+ metadata.gz: 340922f5163f227adffd8ef78dfd7348ad159f86df16fb469e18d92a1f04b08a5769c867d03fe6610e291375fb8c515e86847f171db2552262338b91327eaa03
7
+ data.tar.gz: c99c4423232109007ac971ec2d268ea4642751f0d4bcda3aa91c69c9348371d88e0612439fd583f07ef3d5165d7fd384ffc85c3674cf2d372d559aa3dfdccabe
data/CONTRIBUTORS CHANGED
@@ -5,3 +5,4 @@ Julien Ammous <schmurfy@gmail.com>
5
5
  Nathaniel Pierce <nwpierce@gmail.com>
6
6
  Richard Golding <golding@chrysaetos.org>
7
7
  Joel VanderWerf <vjoel@users.sourceforge.net>
8
+ Dorian Taylor <code@doriantaylor.com>
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)
@@ -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
- $INCFLAGS << " -I$(srcdir)/liblmdb"
8
+ lmdbpath = "../../vendor/libraries/liblmdb"
9
+ $INCFLAGS << " -I$(srcdir)/#{lmdbpath}"
8
10
  $VPATH ||= []
9
- $VPATH << "$(srcdir)/liblmdb"
10
- $srcs = Dir.glob("#{$srcdir}/{,liblmdb/}*.c").map {|n| File.basename(n) }
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'