lmdb 0.4.8 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +42 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/Rakefile +9 -0
  5. data/behaviour.org +35 -0
  6. data/ext/lmdb_ext/env_flags.h +3 -0
  7. data/ext/lmdb_ext/errors.h +6 -0
  8. data/ext/lmdb_ext/extconf.rb +8 -3
  9. data/ext/lmdb_ext/lmdb_ext.c +464 -204
  10. data/ext/lmdb_ext/lmdb_ext.h +25 -5
  11. data/lib/lmdb/database.rb +118 -4
  12. data/lib/lmdb/version.rb +1 -1
  13. data/lmdb.gemspec +8 -7
  14. data/spec/helper.rb +3 -0
  15. data/spec/lmdb_spec.rb +92 -20
  16. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/.gitignore +8 -0
  17. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/COPYRIGHT +1 -1
  18. data/vendor/libraries/liblmdb/Doxyfile +1631 -0
  19. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/LICENSE +0 -0
  20. data/vendor/libraries/liblmdb/Makefile +118 -0
  21. data/vendor/libraries/liblmdb/intro.doc +192 -0
  22. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/lmdb.h +161 -61
  23. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/mdb.c +3244 -1302
  24. data/vendor/libraries/liblmdb/mdb_copy.1 +61 -0
  25. data/vendor/libraries/liblmdb/mdb_copy.c +84 -0
  26. data/vendor/libraries/liblmdb/mdb_drop.1 +40 -0
  27. data/vendor/libraries/liblmdb/mdb_drop.c +135 -0
  28. data/vendor/libraries/liblmdb/mdb_dump.1 +81 -0
  29. data/vendor/libraries/liblmdb/mdb_dump.c +319 -0
  30. data/vendor/libraries/liblmdb/mdb_load.1 +84 -0
  31. data/vendor/libraries/liblmdb/mdb_load.c +492 -0
  32. data/vendor/libraries/liblmdb/mdb_stat.1 +70 -0
  33. data/vendor/libraries/liblmdb/mdb_stat.c +264 -0
  34. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/midl.c +66 -5
  35. data/{ext/lmdb_ext → vendor/libraries}/liblmdb/midl.h +19 -5
  36. data/vendor/libraries/liblmdb/mtest.c +177 -0
  37. data/vendor/libraries/liblmdb/mtest2.c +124 -0
  38. data/vendor/libraries/liblmdb/mtest3.c +133 -0
  39. data/vendor/libraries/liblmdb/mtest4.c +168 -0
  40. data/vendor/libraries/liblmdb/mtest5.c +135 -0
  41. data/vendor/libraries/liblmdb/mtest6.c +141 -0
  42. data/vendor/libraries/liblmdb/sample-bdb.txt +73 -0
  43. data/vendor/libraries/liblmdb/sample-mdb.txt +62 -0
  44. data/vendor/libraries/liblmdb/tooltag +27 -0
  45. metadata +60 -26
  46. data/.gitignore +0 -10
  47. data/.travis.yml +0 -13
  48. data/ext/lmdb_ext/liblmdb/CHANGES +0 -112
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 00ac2d717d44921d8a11dabbe516ba59203b37e2
4
- data.tar.gz: 4cc13fff824970690d1f2e81c14d3be5c91e1df8
2
+ SHA256:
3
+ metadata.gz: d6f0a0943419dca02f5aab8971d28fe32b5771842cbfcb467e6f6c4b368aae4f
4
+ data.tar.gz: 5cd32d2a3b594861d92cfd9dcdd71aed3534b2ea7c4d910b3ce02e07dbb2ba02
5
5
  SHA512:
6
- metadata.gz: c96d8fad469d56c9f9b010952ce2b1e4b94eb0bb247a6abbdd25c9d10b6b016a74a9abaa30763784e5669666e71626c318a1b011fea3ebcca4f75b0100aa5ffd
7
- data.tar.gz: eda8808e0a2844b8d80b9c27203108017e92bfe3dfe75872a336882cf8a7a6a3866b21c2e0ba330375b80d9a31928abf840abffa20a4229ac49fc6cd85c5815b
6
+ metadata.gz: 340922f5163f227adffd8ef78dfd7348ad159f86df16fb469e18d92a1f04b08a5769c867d03fe6610e291375fb8c515e86847f171db2552262338b91327eaa03
7
+ data.tar.gz: c99c4423232109007ac971ec2d268ea4642751f0d4bcda3aa91c69c9348371d88e0612439fd583f07ef3d5165d7fd384ffc85c3674cf2d372d559aa3dfdccabe
data/CHANGES CHANGED
@@ -1,3 +1,45 @@
1
+ 0.5.1
2
+
3
+ * Move read-only operations to read-only transactions (djt)
4
+
5
+ 0.5.0
6
+
7
+ * Add jumping to key-value pairs via MDB_GET_BOTH (djt)
8
+ * Add a number of handy predicates and shortcuts (see docs; djt)
9
+
10
+ 0.4.8
11
+
12
+ * Fix a bug in Database#delete (#38) and add tests.
13
+
14
+ 0.4.7
15
+
16
+ * Fix bug in nested transations (#34).
17
+
18
+ 0.4.6
19
+
20
+ * Import lmdb 0.9.14 source.
21
+ * Handle MDB_MAP_RESIZED during transaction.
22
+ * Expose mdb_env_set_mapsize() as Environment#mapsize=.
23
+ * Cleanup and bug detection in environment_free.
24
+ * Add accessors:
25
+ * Transaction#env
26
+ * Database#env
27
+ * Cursor#database
28
+ * Add Cursor#next_range for iterating up to a specified key.
29
+
30
+ 0.4.5
31
+
32
+ * Expand file paths in #copy and #new.
33
+ * Fix bug: mark cursor list in transaction_mark.
34
+
35
+ 0.4.4
36
+
37
+ * Fix gemspec: permit ruby version >= 2.
38
+
39
+ 0.4.3
40
+
41
+ * Restore 1.9.3 compatibility.
42
+
1
43
  0.4.2
2
44
 
3
45
  * Fix #11, #12, #14.
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)
@@ -6,3 +6,6 @@ FLAG(NOMETASYNC, nometasync)
6
6
  FLAG(WRITEMAP, writemap)
7
7
  FLAG(MAPASYNC, mapasync)
8
8
  FLAG(NOTLS, notls)
9
+ FLAG(NOLOCK, nolock)
10
+ FLAG(NORDAHEAD, nordahead)
11
+ FLAG(NOMEMINIT, nomeminit)
@@ -13,3 +13,9 @@ ERROR(TLS_FULL)
13
13
  ERROR(TXN_FULL)
14
14
  ERROR(CURSOR_FULL)
15
15
  ERROR(PAGE_FULL)
16
+ ERROR(MAP_RESIZED)
17
+ ERROR(INCOMPATIBLE)
18
+ ERROR(BAD_RSLOT)
19
+ ERROR(BAD_TXN)
20
+ ERROR(BAD_VALSIZE)
21
+ ERROR(BAD_DBI)
@@ -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'