odba 1.1.9 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf433bdf191c8648bff438af766f69c0d67719c16bafc26873224bb3b470dedd
4
- data.tar.gz: fac7e49118a2d3be4235b4cd8f6865f6b1f993cb58b11da176ab379a7d8b50fe
3
+ metadata.gz: 384e9358b0cfe5735935d1b1d2e43706b01adaceb9a0c2cce51a357a2a8321eb
4
+ data.tar.gz: 79568f015a42389ee5abe8f159f6baefc0e300ac0c6d692b1856ab7c3613d08b
5
5
  SHA512:
6
- metadata.gz: c3658aaeaed768a1533b2d2f26901a3f1504fca1486061e6b066d4d01eeac4b53c21af09592f217a81ef58b0d19ca09e94655ea002db07fee6c26a5577e62b6d
7
- data.tar.gz: e3bd93f6b85575220201abb7350337025fb0a790c9e4af1c7d791a350184b9f4bb25de9b3705bcd6ec2ff5060fe7cbf574bb787aba7fa3b0221f6d9386e9fddc
6
+ metadata.gz: a2a5cac7871f9d46476e7f45edc3c2afc31dfc2517cfa67b5fdd97e740f331c8b39b018ce2c3928046215d5fcdc11e4dbe2e9b5b70bf6231c33e0690b6bc364f
7
+ data.tar.gz: 967b6811d2f8833145a9ee90ffe6c5b84c896ef23ee663e616b2a9f25efff33930cde98ea4d35b3d279ee6a74feed785badb249d5ca32cd1ba6eeb989fc794a9
@@ -0,0 +1,30 @@
1
+ name: "devenv test using a real postgres database"
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+
7
+ jobs:
8
+ tests:
9
+ strategy:
10
+ matrix:
11
+ os: [ubuntu-latest, macos-latest]
12
+ runs-on: ${{ matrix.os }}
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: cachix/install-nix-action@v26
17
+ - uses: cachix/cachix-action@v14
18
+ with:
19
+ name: devenv
20
+ - name: Install devenv.sh
21
+ run: nix profile install nixpkgs#devenv
22
+
23
+ - name: Build the devenv shell and run any pre-commit hooks
24
+ run: devenv test
25
+
26
+ - name: Run the example.rb which uses a real database
27
+ shell: devenv shell bash -- -e {0}
28
+ run: |
29
+ devenv up --detach
30
+ devenv shell bundle exec ruby test/example.rb
@@ -9,9 +9,11 @@ name: Ruby
9
9
 
10
10
  on:
11
11
  push:
12
- branches: [ master ]
12
+ branches:
13
+ - '*'
13
14
  pull_request:
14
- branches: [ master ]
15
+ branches:
16
+ - '*'
15
17
 
16
18
  jobs:
17
19
  test:
@@ -22,14 +24,13 @@ jobs:
22
24
  fail-fast: false
23
25
  matrix:
24
26
  os: [ ubuntu]
25
- ruby: [2.7, 3.0, 3.1, head]
26
- continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
27
+ ruby: [3.2, 3.3, 3.4]
28
+ continue-on-error: ${{ matrix.ruby.to_s == '3.3' || matrix.ruby.to_s == '3.4' }}
27
29
  steps:
28
30
  - uses: actions/checkout@v2
29
31
  - uses: ruby/setup-ruby@v1
30
32
  with:
31
33
  ruby-version: ${{ matrix.ruby }}
32
34
  bundler-cache: true
33
-
34
- - name: Run tests via rake test
35
- run: bundle exec rake test
35
+ - name: Run tests via test/suite.rb
36
+ run: bundle exec ruby test/suite.rb
data/.gitignore CHANGED
@@ -2,3 +2,14 @@
2
2
  vendor/
3
3
  coverage/
4
4
  pkg/
5
+ Gemfile.lock
6
+
7
+ # Devenv
8
+ .devenv*
9
+ devenv.local.nix
10
+
11
+ # direnv
12
+ .direnv
13
+
14
+ # pre-commit
15
+ .pre-commit-config.yaml
@@ -1,90 +1,110 @@
1
- === 1.1.9 / 28.06.2025
1
+ ## 1.2.0 / 21.08.2026
2
+
3
+ * Reconnect when the database connection was lost. ydbd-pg reports a lost
4
+ connection as DBI::ProgrammingError, which the ConnectionPool excluded from
5
+ its retry, so a restart of the PostgreSQL server left every pooled connection
6
+ broken until the client process itself was restarted
7
+ * Removed obsolete install.rb. Updated History.txt and moved it to History.md
8
+ * Used standarb for all files
9
+ * Removed obsolete (and not needed) WITH_OIDS to allow running with postgres 12 and later
10
+ * Use SimpleCov. Simplified test/test*.rb to include test/helper.rb and start coverage
11
+ * Updated README.md for devenv
12
+ * Run test/exmple.rb using devenv in .github/workflows/devenv.yml
13
+ * Added test/exmple.rb using a real Postgresql 17. Updated README
14
+ * Merged Guide.txt and into README.md
15
+ * Silence NOTICE if table already exists
16
+ * Removed obsolete Manifest.txt and 18_19_loading_compatibility
17
+ * Added devenv environment for Ruby 3.4 and Postgresql 17
18
+ * limit github CI to rubies 3.2,3.3 and 3.4
19
+ * changelog_uri to gemspec
20
+
21
+ ## 1.1.9 / 28.06.2025
2
22
 
3
23
  * bulk_restore throws OdbaError when stack size > 1000
4
24
 
5
- === 1.1.8 / 10.03.2021
25
+ ## 1.1.8 / 10.03.2021
6
26
 
7
27
  * Removed fixed dependency to pg (is optional like mysql2)
8
28
 
9
- === 1.1.7 / 20.01.2021
29
+ ## 1.1.7 / 20.01.2021
10
30
 
11
31
  * Reworked some tests
12
32
  * Updated to use Ruby 3.0.0
13
33
  * Added github actions
14
34
  * Updated to use ydbi 0.5.7
15
35
 
16
- === 1.1.6 / 23.01.2016
36
+ ## 1.1.6 / 23.01.2016
17
37
 
18
38
  * Updated to use ydbi 0.5.6
19
39
 
20
- === 1.1.5 / 23.01.2016
40
+ ## 1.1.5 / 23.01.2016
21
41
 
22
42
  * Remove unused parameter dict for update_fulltext_index
23
43
 
24
- === 1.1.4 / 13.12.2017
44
+ ## 1.1.4 / 13.12.2017
25
45
 
26
46
  * Drop text search dictionaries/configuration before recreating
27
47
  * Remove dictionary argument in fulltext search and index_definition
28
48
 
29
- === 1.1.3 / 12.12.2016
49
+ ## 1.1.3 / 12.12.2016
30
50
 
31
51
  * Avoid errors by always specifying "IF NOT EXISTS" when creating tables and indices
32
52
  * Add utility method get_server_version
33
53
  * Removed misleading check in generate_dictionary
34
54
 
35
- === 1.1.2 / 10.05.2016
55
+ ## 1.1.2 / 10.05.2016
36
56
 
37
57
  * requires now 'ydbi' and 'ydbd-pg'
38
58
 
39
- === 1.1.1 / 10.05.2016
59
+ ## 1.1.1 / 10.05.2016
40
60
 
41
61
  * Made tests pass under Ruby 1.9.3, 2.x
42
62
  * Updated to use minitest
43
63
 
44
- === 1.1.0 / 15.03.2013
64
+ ## 1.1.0 / 15.03.2013
45
65
 
46
66
  * Update dict source file name for multi languages
47
67
 
48
- === 1.0.9 / 15.03.2013
68
+ ## 1.0.9 / 15.03.2013
49
69
 
50
70
  * Update dictionary to be suitable for new tsearch2
51
71
  - generate_dictionary API is changed.
52
72
  - generate_dictionary needs dict source files(dict, affix, stop)
53
73
  into /usr/share/postgresql/tsearch_data.
54
74
 
55
- === 1.0.8 / 09.01.2012
75
+ ## 1.0.8 / 09.01.2012
56
76
 
57
77
  * Added exclusive control to update @accessed_by Hash variable in CacheEntry class using mutex (Patinfo-Invoice Error)
58
78
 
59
- === 1.0.7 / 27.12.2011
79
+ ## 1.0.7 / 27.12.2011
60
80
 
61
81
  * Debugged Hash iteration error during cleaning @fetched and @prefetched objects
62
82
 
63
- === 1.0.6 / 23.12.2011
83
+ ## 1.0.6 / 23.12.2011
64
84
 
65
85
  * Fix all the elements of odba_potentials and odba_exclude_vars to be Symbols for Ruby 1.9.3
66
86
 
67
- === 1.0.5 / 20.12.2011
87
+ ## 1.0.5 / 20.12.2011
68
88
 
69
89
  * Added attr_accessor :odba_persistent so we can update doctor addresses on ch.oddb.org
70
90
 
71
- === 1.0.4 / 12.12.2011
91
+ ## 1.0.4 / 12.12.2011
72
92
 
73
93
  * Fixed file lock process by using @file_lock flag variable to control it in application side
74
94
 
75
- === 1.0.3 / 09.12.2011
95
+ ## 1.0.3 / 09.12.2011
76
96
 
77
97
  * Debugged ODBA::Cache#next_id
78
98
 
79
- === 1.0.2 / 09.12.2011
99
+ ## 1.0.2 / 09.12.2011
80
100
 
81
101
  * Updated cache.rb persitatble.rb 18_19_loading_compatibility.rb to be compatible for both Ruby 1.8 and 1.9
82
102
 
83
- === 1.0.1 / 08.12.2011
103
+ ## 1.0.1 / 08.12.2011
84
104
 
85
105
  * Added file lock exclusive control to create a new odba_id between processes.
86
106
 
87
- === 1.0.0 / 20.12.2010
107
+ ## 1.0.0 / 20.12.2010
88
108
 
89
109
  * Add ODBA.cache.index_matches(index_name, substring)
90
110
 
data/README.md CHANGED
@@ -1,10 +1,23 @@
1
1
  # odba
2
2
 
3
+ ODBA is an unintrusive Object Cache system. It adresses the crosscutting
4
+ concern of object storage by disconnecting and serializing objects into
5
+ storage. All disconnected connections are replaced by instances of
6
+ ODBA::Stub, thus enabling transparent object-loading.
7
+
8
+
3
9
  * https://github.com/zdavatz/odba
4
10
 
5
11
  To see a graphical overview of the Library please see
6
12
 
7
- * https://raw.githubusercontent.com/ngiger/odba/master/odba.jpeg
13
+ * https://raw.githubusercontent.com/zdavatz/odba/master/odba.jpeg
14
+
15
+ ## ODBA supports
16
+
17
+ * transparent loading of connected objects
18
+ * index-vectors
19
+ * transactions
20
+ * transparently fetches Hash-Elements without loading the entire Hash
8
21
 
9
22
  ## DESCRIPTION:
10
23
 
@@ -15,6 +28,68 @@ To see a graphical overview of the Library please see
15
28
 
16
29
  * There may still be an sql bottleneck. Has to be investigated further.
17
30
  * You will need postgresql installed.
31
+ * The unit test test_clean__prefetched in test/test_cache.rb fails with Ruby 3.3/3.4 sometimes but not always
32
+ * Rework the unit tests to use a test database and less flexmock
33
+ * Rebase the library on the Sequel gem instead of ydbi/ydbd_pg
34
+
35
+ ## Example
36
+
37
+ You may find this code and some tests which is using this (example)[https://github.com/zdavatz/odba/blob/master/test/example.rb]
38
+
39
+ require "odba/connection_pool"
40
+
41
+ class User
42
+ attr_accessor :first_name, :last_name
43
+ include ODBA::Persistable
44
+ def initialize(first_name, last_name)
45
+ @first_name = first_name
46
+ @last_name = last_name
47
+ end
48
+
49
+ def to_s
50
+ "#{@first_name} #{@last_name}"
51
+ end
52
+ end
53
+
54
+ class Example
55
+ def self.db_setup
56
+ # connect default storage manager to a relational database on
57
+ # our localhost using port 5435 with a user odba_test and an empty password
58
+ ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:dbname=odba_test;host=127.0.0.1;port=5432", "odba_test", "")
59
+ ODBA.cache.setup
60
+ end
61
+
62
+ def self.show_last_added_user
63
+ res = ODBA.storage.dbi.select_all("Select count(*) from object;").first.first
64
+ odba_id = ODBA.storage.dbi.select_one("select odba_id from object order by odba_id desc limit 1;")
65
+ puts "show_last_added_user: We have #{res} objects. Highest odba_id is #{odba_id}"
66
+ first = ODBA.storage.dbi.select_one("select odba_id, name, prefetchable, extent, content from object order by odba_id desc limit 1;")
67
+ puts " DB-content is #{first}"
68
+ puts " Fetched object for odba_id #{odba_id} is #{ODBA.cache.fetch(odba_id.first)}"
69
+ end
70
+ end
71
+
72
+ Example.db_setup
73
+ composer = User.new("Ludwig", "Van Beethoven")
74
+ composer.odba_store
75
+ Example.show_last_added_user
76
+ painter = User.new("Vincent", "Van Gogh")
77
+ painter.odba_store
78
+ scientist = User.new("Albert", "Einstein")
79
+ scientist.odba_store
80
+ Example.show_last_added_user
81
+
82
+ You will see something like
83
+
84
+ show_last_added_user: We have 2 objects. Highest odba_id is [2]
85
+ DB-content is [2, nil, false, "User", "04086f3a09557365720b3a104066697273745f6e616d6549220b4c7564776967063a0645543a0f406c6173745f6e616d6549221256616e2042656574686f76656e063b07543a15406f6462615f70657273697374656e74543a0d406f6462615f696469073a14406f6462615f6f6273657276657273303a13406f6462615f707265666574636830"]
86
+ Fetched object for odba_id [2] is Ludwig Van Beethoven
87
+ show_last_added_user: We have 4 objects. Highest odba_id is [4]
88
+ DB-content is [4, nil, false, "User", "04086f3a09557365720b3a104066697273745f6e616d6549220b416c62657274063a0645543a0f406c6173745f6e616d6549220d45696e737465696e063b07543a15406f6462615f70657273697374656e74543a0d406f6462615f696469093a14406f6462615f6f6273657276657273303a13406f6462615f707265666574636830"]
89
+ Fetched object for odba_id [4] is Albert Einstein
90
+
91
+
92
+ This example is run on each push to github via the (github action)[https://github.com/zdavatz/odba/blob/master/.github/workflows/devenv.yml]. It is based on (devenv.sh)[https://devenv.sh/], which ensures reproducability.
18
93
 
19
94
  ## INSTALL:
20
95
 
@@ -25,6 +100,7 @@ To see a graphical overview of the Library please see
25
100
  * Masamoi Hatakeyama
26
101
  * Zeno R.R. Davatz
27
102
  * Hannes Wyss (up to Version 1.0)
103
+ * Niklaus Giger (Porting to Ruby 2.x and 3.x, cleanup)
28
104
 
29
105
  ## LICENSE:
30
106
 
data/Rakefile CHANGED
@@ -1,25 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
3
2
  lib = File.expand_path('../lib', __FILE__)
4
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
4
  require 'odba/version'
6
5
  require "bundler/gem_tasks"
7
6
  require 'rake/testtask'
8
7
 
9
- # dependencies are now declared in odba.gemspec
10
-
11
- desc 'Offer a gem task like hoe'
12
- task :gem => :build do
13
- Rake::Task[:build].invoke
14
- end
15
-
16
- desc "Run tests"
17
- task :default => :test
18
-
19
- Rake::TestTask.new(:test) do |t|
20
- t.libs << "test"
21
- t.libs << "lib"
22
- t.test_files = FileList["test/**/test_*.rb"]
8
+ task default: "test"
9
+ Rake::TestTask.new(:test) do |task|
10
+ require_relative 'test/suite'
23
11
  end
24
12
 
25
13
 
data/devenv.lock ADDED
@@ -0,0 +1,171 @@
1
+ {
2
+ "nodes": {
3
+ "devenv": {
4
+ "locked": {
5
+ "dir": "src/modules",
6
+ "lastModified": 1736426010,
7
+ "owner": "cachix",
8
+ "repo": "devenv",
9
+ "rev": "1c384bc4be3ee571511fbbc6fdc94fe47d60f6cf",
10
+ "type": "github"
11
+ },
12
+ "original": {
13
+ "dir": "src/modules",
14
+ "owner": "cachix",
15
+ "repo": "devenv",
16
+ "type": "github"
17
+ }
18
+ },
19
+ "flake-compat": {
20
+ "flake": false,
21
+ "locked": {
22
+ "lastModified": 1733328505,
23
+ "owner": "edolstra",
24
+ "repo": "flake-compat",
25
+ "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
26
+ "type": "github"
27
+ },
28
+ "original": {
29
+ "owner": "edolstra",
30
+ "repo": "flake-compat",
31
+ "type": "github"
32
+ }
33
+ },
34
+ "flake-compat_2": {
35
+ "flake": false,
36
+ "locked": {
37
+ "lastModified": 1733328505,
38
+ "owner": "edolstra",
39
+ "repo": "flake-compat",
40
+ "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
41
+ "type": "github"
42
+ },
43
+ "original": {
44
+ "owner": "edolstra",
45
+ "repo": "flake-compat",
46
+ "type": "github"
47
+ }
48
+ },
49
+ "flake-utils": {
50
+ "inputs": {
51
+ "systems": "systems"
52
+ },
53
+ "locked": {
54
+ "lastModified": 1731533236,
55
+ "owner": "numtide",
56
+ "repo": "flake-utils",
57
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
58
+ "type": "github"
59
+ },
60
+ "original": {
61
+ "owner": "numtide",
62
+ "repo": "flake-utils",
63
+ "type": "github"
64
+ }
65
+ },
66
+ "git-hooks": {
67
+ "inputs": {
68
+ "flake-compat": "flake-compat",
69
+ "gitignore": "gitignore",
70
+ "nixpkgs": [
71
+ "nixpkgs"
72
+ ]
73
+ },
74
+ "locked": {
75
+ "lastModified": 1742649964,
76
+ "owner": "cachix",
77
+ "repo": "git-hooks.nix",
78
+ "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
79
+ "type": "github"
80
+ },
81
+ "original": {
82
+ "owner": "cachix",
83
+ "repo": "git-hooks.nix",
84
+ "type": "github"
85
+ }
86
+ },
87
+ "gitignore": {
88
+ "inputs": {
89
+ "nixpkgs": [
90
+ "git-hooks",
91
+ "nixpkgs"
92
+ ]
93
+ },
94
+ "locked": {
95
+ "lastModified": 1709087332,
96
+ "owner": "hercules-ci",
97
+ "repo": "gitignore.nix",
98
+ "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
99
+ "type": "github"
100
+ },
101
+ "original": {
102
+ "owner": "hercules-ci",
103
+ "repo": "gitignore.nix",
104
+ "type": "github"
105
+ }
106
+ },
107
+ "nixpkgs": {
108
+ "locked": {
109
+ "lastModified": 1736200483,
110
+ "owner": "NixOS",
111
+ "repo": "nixpkgs",
112
+ "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
113
+ "type": "github"
114
+ },
115
+ "original": {
116
+ "owner": "NixOS",
117
+ "ref": "nixos-24.11",
118
+ "repo": "nixpkgs",
119
+ "type": "github"
120
+ }
121
+ },
122
+ "nixpkgs-ruby": {
123
+ "inputs": {
124
+ "flake-compat": "flake-compat_2",
125
+ "flake-utils": "flake-utils",
126
+ "nixpkgs": [
127
+ "nixpkgs"
128
+ ]
129
+ },
130
+ "locked": {
131
+ "lastModified": 1735192621,
132
+ "owner": "bobvanderlinden",
133
+ "repo": "nixpkgs-ruby",
134
+ "rev": "602c528c8228f231f912c6d117703a1700464202",
135
+ "type": "github"
136
+ },
137
+ "original": {
138
+ "owner": "bobvanderlinden",
139
+ "repo": "nixpkgs-ruby",
140
+ "type": "github"
141
+ }
142
+ },
143
+ "root": {
144
+ "inputs": {
145
+ "devenv": "devenv",
146
+ "git-hooks": "git-hooks",
147
+ "nixpkgs": "nixpkgs",
148
+ "nixpkgs-ruby": "nixpkgs-ruby",
149
+ "pre-commit-hooks": [
150
+ "git-hooks"
151
+ ]
152
+ }
153
+ },
154
+ "systems": {
155
+ "locked": {
156
+ "lastModified": 1681028828,
157
+ "owner": "nix-systems",
158
+ "repo": "default",
159
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
160
+ "type": "github"
161
+ },
162
+ "original": {
163
+ "owner": "nix-systems",
164
+ "repo": "default",
165
+ "type": "github"
166
+ }
167
+ }
168
+ },
169
+ "root": "root",
170
+ "version": 7
171
+ }
data/devenv.nix ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ inputs,
3
+ pkgs,
4
+ config,
5
+ lib,
6
+ ...
7
+ }:
8
+ {
9
+
10
+ # https://devenv.sh/basics/
11
+ env.GREET = "devenv";
12
+
13
+ # https://devenv.sh/packages/
14
+ packages = [
15
+ pkgs.git
16
+ pkgs.libyaml
17
+ pkgs.nixfmt-rfc-style
18
+ ];
19
+
20
+ enterShell = ''
21
+ echo This is the devenv shell for odba_test
22
+ git --version
23
+ ruby --version
24
+ psql --version
25
+ bundle install
26
+ '';
27
+ services.postgres = {
28
+ enable = true;
29
+ package = pkgs.postgresql_17;
30
+ listen_addresses = "0.0.0.0";
31
+ port = 5432;
32
+
33
+ initialDatabases = [
34
+ { name = "odba_test"; }
35
+ ];
36
+
37
+ initdbArgs = [
38
+ "--locale=C"
39
+ "--encoding=UTF8"
40
+ ];
41
+
42
+ initialScript = ''
43
+ create role odba_test superuser login password null;
44
+ '';
45
+ };
46
+ languages.ruby.enable = true;
47
+ languages.ruby.version = "3.4";
48
+ # See full reference at https://devenv.sh/reference/options/
49
+ enterTest = ''
50
+ devenv up --detach
51
+ bundle exec test/example.rb
52
+ '';
53
+ }
data/devenv.yaml ADDED
@@ -0,0 +1,8 @@
1
+ inputs:
2
+ nixpkgs:
3
+ url: github:NixOS/nixpkgs/nixos-24.11
4
+ nixpkgs-ruby:
5
+ url: github:bobvanderlinden/nixpkgs-ruby
6
+ inputs:
7
+ nixpkgs:
8
+ follows: nixpkgs