mdbx 0.3.4 → 0.3.5

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
2
  SHA256:
3
- metadata.gz: a6ce9c7c96bb8e8857f7a6150df3ded621f5eca3d40848f52999fbe8192f72de
4
- data.tar.gz: 8445320bae46524ae7dac00dfb9b1bc6d38c9401607a5d2d983380fa73c8d2b4
3
+ metadata.gz: 7eb0c032fc0a9fd7c91e0db5f6bbd876921fac5e886de80651d7eaf6564e7629
4
+ data.tar.gz: 2820244c2ed1c1e6ed8efd6275fd62d4f62d5668f2a2d346056c70aef05b9dd1
5
5
  SHA512:
6
- metadata.gz: 0d062355ba32667ac5f4f1d2e6a26a977823d2b0cf841d2f0131509bd2b96f7e36eeb981e96c343a3d960ba77f23996a57f0d1dad4210c99cce9cf870d7a36ee
7
- data.tar.gz: 2e517e62946e3005da7d5e20190c5362106253fb925c1bd97e15fc4d7fdf5a0e7c536553babb5ef9b704043f7646dbc1dc46873d9939dd85c64a665562fe0de5
6
+ metadata.gz: 65b7dab9c906a5dc50965ed8561a2eb9965eadf724e38f13fafe67cce6791ab1fca2992463dc9b8459f5ef6c97cb326439944faa7bbe60dc8fb03d41e9cc1f6d
7
+ data.tar.gz: 89c8f70c38f150986b1b76052cc8870e5ab0705af73e59f5db9d20f91a6d201b47a6e2cd8c85a663dd0404a01fb46f10ccda38febfbfb53a19619badeda5889c
checksums.yaml.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Release History for MDBX
2
2
 
3
+ ---
4
+ ## v0.3.5 [2023-03-24] Mahlon E. Smith <mahlon@martini.nu>
5
+
6
+ Add support for libmdbx 0.12.x.
7
+
8
+
9
+ Bugfixes:
10
+
11
+ - Ensure transactions are closed if exceptions are raised.
12
+
13
+
3
14
  ---
4
15
  ## v0.3.4 [2022-12-21] Mahlon E. Smith <mahlon@martini.nu>
5
16
 
data/README.md CHANGED
@@ -7,7 +7,7 @@ home
7
7
  docs
8
8
  : https://martini.nu/docs/ruby-mdbx
9
9
 
10
- github mirror
10
+ github_mirror
11
11
  : https://github.com/mahlonsmith/ruby-mdbx
12
12
 
13
13
 
@@ -15,6 +15,8 @@ github mirror
15
15
 
16
16
  This is a Ruby (MRI) binding for the libmdbx database library.
17
17
 
18
+ [![Gem Version](https://badge.fury.io/rb/mdbx.svg)](https://badge.fury.io/rb/mdbx)
19
+
18
20
  libmdbx is an extremely fast, compact, powerful, embedded, transactional
19
21
  key-value database, with a permissive license. libmdbx has a specific set
20
22
  of properties and capabilities, focused on creating unique lightweight
@@ -26,7 +28,7 @@ For more information about libmdbx (features, limitations, etc), see the
26
28
 
27
29
  ## Prerequisites
28
30
 
29
- * Ruby 2.6+
31
+ * Ruby 3.0+
30
32
  * [libmdbx](https://gitflic.ru/project/erthink/libmdbx)
31
33
 
32
34
 
@@ -330,12 +332,84 @@ Calling `statistics` on a database handle will provide a subset of
330
332
  information about the build environment, the database environment, and
331
333
  the currently connected clients.
332
334
 
335
+ ```bash
336
+ % ruby -rmdbx -rjson -e "puts JSON.generate( MDBX::Database.open( '/tmp/testdb' ).statistics )" | jq
337
+ ```
338
+
339
+ ```json
340
+ {
341
+ "build": {
342
+ "compiler": "FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)",
343
+ "flags": "-DNDEBUG=1 -std=gnu++2b -O2 -pipe -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes -fstack-protector-strong -fno-strict-aliasing -fstack-
344
+ protector-strong",
345
+ "options": {
346
+ "MDBX_DEBUG": 0,
347
+ "MDBX_WORDBITS": 64,
348
+ "BYTE_ORDER": "LITTLE_ENDIAN",
349
+ "MDBX_ENV_CHECKPID": "AUTO",
350
+ "MDBX_TXN_CHECKOWNER": "AUTO",
351
+ "MDBX_64BIT_ATOMIC": "AUTO",
352
+ "MDBX_64BIT_CAS": "AUTO",
353
+ "MDBX_TRUST_RTC": "AUTO",
354
+ "MDBX_ENABLE_REFUND": 1,
355
+ "MDBX_ENABLE_MADVISE": 1,
356
+ "_GNU_SOURCE": "NO",
357
+ "MDBX_LOCKING": "AUTO",
358
+ "MDBX_USE_OFDLOCKS": "AUTO",
359
+ "MDBX_CACHELINE_SIZE": 64,
360
+ "MDBX_CPU_WRITEBACK_INCOHERENT": 0,
361
+ "MDBX_MMAP_INCOHERENT_CPU_CACHE": 0,
362
+ "MDBX_MMAP_INCOHERENT_FILE_WRITE": 0,
363
+ "MDBX_UNALIGNED_OK": 0,
364
+ "MDBX_PNL_ASCENDING": 0
365
+ },
366
+ "target": "x86_64-unknown-freebsd13.1"
367
+ },
368
+ "system_memory": {
369
+ "pagesize": 4096,
370
+ "total_pages": 33522850,
371
+ "avail_pages": 4170509
372
+ },
373
+ "environment": {
374
+ "pagesize": 4096,
375
+ "branch_pages": 0,
376
+ "leaf_pages": 0,
377
+ "overflow_pages": 0,
378
+ "btree_depth": 0,
379
+ "entries": 0,
380
+ "last_txnid": 3,
381
+ "last_reader_txnid": 3,
382
+ "max_readers": 120,
383
+ "readers_in_use": 1,
384
+ "datafile": {
385
+ "size_current": 12288,
386
+ "pages": 3,
387
+ "type": "dynamic",
388
+ "size_lower": 12288,
389
+ "size_upper": 1048576,
390
+ "growth_step": 65536,
391
+ "shrink_threshold": 131072
392
+ }
393
+ },
394
+ "readers": [
395
+ {
396
+ "slot": 0,
397
+ "pid": 16731,
398
+ "thread": 34374492160,
399
+ "txnid": 0,
400
+ "lag": 0,
401
+ "bytes_used": 0,
402
+ "bytes_retired": 0
403
+ }
404
+ ]
405
+ }
406
+ ```
333
407
 
334
408
  ## Contributing
335
409
 
336
410
  You can check out the current development source with Fossil via its
337
411
  [home repo](https://code.martini.nu/fossil/ruby-mdbx), or with Git at its
338
- [project mirror](https://gitlab.com/mahlon/ruby-mdbx).
412
+ [project mirror](https://github.com/mahlonsmith/ruby-mdbx)
339
413
 
340
414
  After checking out the source, run:
341
415
 
@@ -346,6 +420,19 @@ This will install dependencies, and do any other necessary setup for
346
420
  development.
347
421
 
348
422
 
423
+ ## Reporting Issues
424
+
425
+ Tests are performed against the latest stable MRI Ruby, and I endeavor to test
426
+ against the latest stable libmdbx (as of this writing, the 0.12.x versioning),
427
+ on both x86 and ARM chipsets.
428
+
429
+ Things may work for you in other environments - I'm just not matrix testing
430
+ every possible permutation.
431
+
432
+ Bugs reported against tested environments take precedence over others. Please
433
+ report any issues [here](https://code.martini.nu/fossil/ruby-mdbx/tktnew).
434
+
435
+
349
436
  ## Authors
350
437
 
351
438
  - Mahlon E. Smith <mahlon@martini.nu>
@@ -353,7 +440,7 @@ development.
353
440
 
354
441
  ## License
355
442
 
356
- Copyright (c) 2020-2022 Mahlon E. Smith
443
+ Copyright (c) 2020-2023 Mahlon E. Smith
357
444
  All rights reserved.
358
445
 
359
446
  Redistribution and use in source and binary forms, with or without
@@ -168,6 +168,12 @@ rmdbx_open_env( VALUE self )
168
168
  rb_raise( rmdbx_eDatabaseError, "mdbx_env_open: (%d) %s", rc, mdbx_strerror(rc) );
169
169
  }
170
170
 
171
+ /* Force populate the db->dbi handle. Under 0.12.x, getting a
172
+ * 'permission denied' doing this for the first access with a RDONLY
173
+ * for some reason. */
174
+ rmdbx_open_txn( db, MDBX_TXN_READWRITE );
175
+ rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
176
+
171
177
  db->state.open = 1;
172
178
  return Qtrue;
173
179
  }
@@ -189,8 +195,10 @@ rmdbx_clear( VALUE self )
189
195
  rmdbx_open_txn( db, MDBX_TXN_READWRITE );
190
196
  int rc = mdbx_drop( db->txn, db->dbi, false );
191
197
 
192
- if ( rc != MDBX_SUCCESS )
198
+ if ( rc != MDBX_SUCCESS ) {
199
+ rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
193
200
  rb_raise( rmdbx_eDatabaseError, "mdbx_drop: (%d) %s", rc, mdbx_strerror(rc) );
201
+ }
194
202
 
195
203
  rmdbx_close_txn( db, RMDBX_TXN_COMMIT );
196
204
 
@@ -229,8 +237,10 @@ rmdbx_drop( VALUE self, VALUE name )
229
237
  rmdbx_open_txn( db, MDBX_TXN_READWRITE );
230
238
  int rc = mdbx_drop( db->txn, db->dbi, true );
231
239
 
232
- if ( rc != MDBX_SUCCESS )
240
+ if ( rc != MDBX_SUCCESS ) {
241
+ rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
233
242
  rb_raise( rmdbx_eDatabaseError, "mdbx_drop: (%d) %s", rc, mdbx_strerror(rc) );
243
+ }
234
244
 
235
245
  rmdbx_close_txn( db, RMDBX_TXN_COMMIT );
236
246
 
@@ -238,6 +248,12 @@ rmdbx_drop( VALUE self, VALUE name )
238
248
  db->subdb = NULL;
239
249
  rmdbx_close_dbi( db ); /* ensure next access is not in the defunct subdb */
240
250
 
251
+ /* Force populate the new db->dbi handle. Under 0.12.x, getting a
252
+ * 'permission denied' doing this for the first access with a RDONLY
253
+ * for some reason. */
254
+ rmdbx_open_txn( db, MDBX_TXN_READWRITE );
255
+ rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
256
+
241
257
  return self;
242
258
  }
243
259
 
@@ -830,7 +846,7 @@ rmdbx_stats( VALUE self )
830
846
  * db.clone => [copy of db]
831
847
  *
832
848
  * Copy the object (clone/dup). The returned copy is closed and needs
833
- * to be reopened before use. This function likely has limited use,
849
+ * to be reopened before use. This function likely has limited use,
834
850
  * considering you can't open two handles within the same process.
835
851
  */
836
852
  static VALUE rmdbx_init_copy( VALUE copy, VALUE orig )
@@ -857,7 +873,7 @@ static VALUE rmdbx_init_copy( VALUE copy, VALUE orig )
857
873
  * Initialization for the MDBX::Database class.
858
874
  */
859
875
  void
860
- rmdbx_init_database()
876
+ rmdbx_init_database( void )
861
877
  {
862
878
  rmdbx_cDatabase = rb_define_class_under( rmdbx_mMDBX, "Database", rb_cObject );
863
879
 
@@ -3,6 +3,8 @@
3
3
 
4
4
  require 'mkmf'
5
5
 
6
+ $CFLAGS << ' -Wno-suggest-attribute=format'
7
+
6
8
  have_library( 'mdbx' ) or abort "No mdbx library!"
7
9
  have_header( 'mdbx.h' ) or abort "No mdbx.h header!"
8
10
 
@@ -58,13 +58,11 @@ rmdbx_log( const char *level, const char *fmt, va_dcl )
58
58
  }
59
59
 
60
60
 
61
-
62
-
63
61
  /*
64
62
  * MDBX initialization
65
63
  */
66
64
  void
67
- Init_mdbx_ext()
65
+ Init_mdbx_ext( void )
68
66
  {
69
67
  rmdbx_mMDBX = rb_define_module( "MDBX" );
70
68
 
data/lib/mdbx.rb CHANGED
@@ -13,7 +13,7 @@ module MDBX
13
13
  extend Loggability
14
14
 
15
15
  # The version of this gem.
16
- VERSION = '0.3.4'
16
+ VERSION = '0.3.5'
17
17
 
18
18
 
19
19
  log_as :mdbx
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdbx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mahlon E. Smith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -34,7 +34,7 @@ cert_chain:
34
34
  49pOzX5KHZLTS9DKeaP/xcGPz6C8MiwQdYrZarr2SHRASX1zFa79rkItO8kE6RDr
35
35
  b6WDF79UvZ55ajtE00TiwqjQL/ZPEtbd
36
36
  -----END CERTIFICATE-----
37
- date: 2022-12-21 00:00:00.000000000 Z
37
+ date: 2024-03-24 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: loggability
@@ -98,34 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.15'
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: 0.15.1
101
+ version: '0.22'
105
102
  type: :development
106
103
  prerelease: false
107
104
  version_requirements: !ruby/object:Gem::Requirement
108
105
  requirements:
109
106
  - - "~>"
110
107
  - !ruby/object:Gem::Version
111
- version: '0.15'
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: 0.15.1
108
+ version: '0.22'
115
109
  - !ruby/object:Gem::Dependency
116
- name: rdoc-generator-fivefish
110
+ name: rdoc-generator-sixfish
117
111
  requirement: !ruby/object:Gem::Requirement
118
112
  requirements:
119
113
  - - "~>"
120
114
  - !ruby/object:Gem::Version
121
- version: '0.4'
115
+ version: '0.2'
122
116
  type: :development
123
117
  prerelease: false
124
118
  version_requirements: !ruby/object:Gem::Requirement
125
119
  requirements:
126
120
  - - "~>"
127
121
  - !ruby/object:Gem::Version
128
- version: '0.4'
122
+ version: '0.2'
129
123
  - !ruby/object:Gem::Dependency
130
124
  name: rspec
131
125
  requirement: !ruby/object:Gem::Requirement
@@ -213,7 +207,7 @@ metadata:
213
207
  homepage_uri: https://code.martini.nu/fossil/ruby-mdbx
214
208
  documentation_uri: https://martini.nu/docs/ruby-mdbx
215
209
  changelog_uri: https://martini.nu/docs/ruby-mdbx/History_md.html
216
- post_install_message:
210
+ post_install_message:
217
211
  rdoc_options: []
218
212
  require_paths:
219
213
  - lib
@@ -228,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
222
  - !ruby/object:Gem::Version
229
223
  version: '0'
230
224
  requirements: []
231
- rubygems_version: 3.3.7
232
- signing_key:
225
+ rubygems_version: 3.4.19
226
+ signing_key:
233
227
  specification_version: 4
234
228
  summary: A ruby binding to libmdbx, an improved version of the Lightning Memory Mapped
235
229
  Database.
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- 0:����$̃�Z���7=H�Z�N�v��x��v2S�֙�������˻Y_�{<�e >S�OC1�R�VA($Œ<k��'�rP�!.��lE"&�z�w�X�_J� ��~��G|����^��L(I����'l�����^��f��q�e�^ GB΅�霂!,�c ji�f4TI,�ǵ,e��N��D>�� �ȟv5ڪ8�숱�=H���[޶�0�h�J���aƤe�29�8�~�GKً~Fh�5�P��Ϸ�W�p�Hu^��_��8��4����
2
- ��CC)ha���Z���.�W98 0㣜V,�*��[��3gC��ź���c�*4%��rD���~@���?7VOPա�y"a��kA9(�JXcN_U+�GX]
1
+ [S\��ذچ
2
+ Ab����נ�i��s;1���;�����uZr{|��ׇ�iQZc��� A��-���D�0�1�T�� ����J[7���x��n]CEd
3
+ A� ��u|�3�Һ�7