lmdb 0.4.7 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bead2398fe212913ca5c86034ebaf619212b20f0
4
- data.tar.gz: 46b8093e97073e46aa7e57054ee66e0138f48383
2
+ SHA256:
3
+ metadata.gz: 2eac165bb0261c0af6813f16df9b725b2ca2a63f4c5de98734473d9976930735
4
+ data.tar.gz: 3aa0562060e4586dd7c7a44e795adc1449f489f57634787ef5e6480abbd49a48
5
5
  SHA512:
6
- metadata.gz: 9a8bc109d1b095471a9711d85fe377e7cf981dc371b2090e40a48701c6eb457541ca1a494a240ba6d4178043ee547d302c34124a96d3d1a15a7b41a0bb410174
7
- data.tar.gz: 2a6afea7ab6d1a6811aed004026b7f3b0e6fb95634ff84125e8420cf369eba12a3339aaca8acc2704f054cad90cd8fea5642e3237a27df3ea92c7e796860ca60
6
+ metadata.gz: 22cc9f78002a05aa25fba212e4d3e3e97566ed7a9bd2e0c84996297398131b5afd57da0e1510a27086ac4b1938401d1369393f9b0515bdd044856109510c6432
7
+ data.tar.gz: eea983ccb0638bed2dbcfcd3e2ea76271072ea91d259b95e392d505c26f184c351f89ae6076025b93f47bfec3e42add3ec41055e5edb67bee5bfec2e8e341a80
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.o
2
2
  *.so
3
+ *.bundle
3
4
  .#*
4
5
  *.log
5
6
  *.mdb
@@ -7,4 +8,8 @@ Makefile
7
8
  tmp/
8
9
  Gemfile.lock
9
10
  doc/
10
- .yardoc/
11
+ .yardoc/
12
+ *.gem
13
+ dtrace/
14
+ \#*\#
15
+ .\#*
data/.travis.yml CHANGED
@@ -1,13 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.0
3
+ - 2.3.8
4
+ - 2.4.9
5
+ - 2.5.7
6
+ - 2.6.3
7
+ - 2.7.0
7
8
  - ruby-head
8
9
  - rbx
9
10
  matrix:
10
11
  allow_failures:
11
12
  - rvm: ruby-head
12
- - rvm: 1.8.7
13
+ - rvm: 2.3.8
13
14
  - rvm: rbx
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/README.md CHANGED
@@ -45,7 +45,7 @@ env.close
45
45
 
46
46
  If you want to have a simpler interface to LMDB databases please consider using [Moneta](https://github.com/minad/moneta). The Moneta gem provides an LMDB adapter which uses this gem.
47
47
 
48
- ## Licence (MIT)
48
+ ## License (MIT)
49
49
 
50
50
  ```
51
51
  Copyright (c) 2013 Daniel Mendler
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,6 +1,7 @@
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'))