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 +5 -5
- data/.gitignore +6 -1
- data/.travis.yml +6 -5
- data/CHANGES +42 -0
- data/CONTRIBUTORS +1 -0
- data/README.md +1 -1
- data/Rakefile +9 -0
- data/behaviour.org +35 -0
- data/ext/lmdb_ext/env_flags.h +3 -0
- data/ext/lmdb_ext/errors.h +6 -0
- data/ext/lmdb_ext/extconf.rb +1 -0
- data/ext/lmdb_ext/lmdb_ext.c +363 -113
- data/ext/lmdb_ext/lmdb_ext.h +25 -5
- data/lib/lmdb/database.rb +118 -4
- data/lib/lmdb/version.rb +1 -1
- data/lmdb.gemspec +4 -3
- data/spec/helper.rb +3 -0
- data/spec/lmdb_spec.rb +109 -24
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2eac165bb0261c0af6813f16df9b725b2ca2a63f4c5de98734473d9976930735
|
4
|
+
data.tar.gz: 3aa0562060e4586dd7c7a44e795adc1449f489f57634787ef5e6480abbd49a48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22cc9f78002a05aa25fba212e4d3e3e97566ed7a9bd2e0c84996297398131b5afd57da0e1510a27086ac4b1938401d1369393f9b0515bdd044856109510c6432
|
7
|
+
data.tar.gz: eea983ccb0638bed2dbcfcd3e2ea76271072ea91d259b95e392d505c26f184c351f89ae6076025b93f47bfec3e42add3ec41055e5edb67bee5bfec2e8e341a80
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
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
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
|
-
##
|
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)
|
data/ext/lmdb_ext/env_flags.h
CHANGED
data/ext/lmdb_ext/errors.h
CHANGED
data/ext/lmdb_ext/extconf.rb
CHANGED