odba 1.1.8 → 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: ea6d762105361b4b4d352bc10e485ecbffd0981f6ea6612b6128d0e1932a0264
4
- data.tar.gz: 748b12ad5519b0afa70475174e06511260e7e6bf732d1fbe5fbcc1fa5f31ee87
3
+ metadata.gz: 384e9358b0cfe5735935d1b1d2e43706b01adaceb9a0c2cce51a357a2a8321eb
4
+ data.tar.gz: 79568f015a42389ee5abe8f159f6baefc0e300ac0c6d692b1856ab7c3613d08b
5
5
  SHA512:
6
- metadata.gz: 4d1b73f2969bbb84f45ba28320e58f3a4b7a8ea2749e51e39f3ce25e67328cc78935607ab77d30214fca4eec617ccfbdb5974f719b3c6c84746b0ea0cf65b6df
7
- data.tar.gz: dbad2568c1ec84b5e247a7d11f60ac58ce5100ac26bc26b9b3fd364c5c16c5cc16a5e975d43281d4c6946e6b1be762eb5831c89def18b963939d4d64cad4b5af
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, 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,86 +1,110 @@
1
- === 1.1.8 / 10.03.2021
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
22
+
23
+ * bulk_restore throws OdbaError when stack size > 1000
24
+
25
+ ## 1.1.8 / 10.03.2021
2
26
 
3
27
  * Removed fixed dependency to pg (is optional like mysql2)
4
28
 
5
- === 1.1.7 / 20.01.2021
29
+ ## 1.1.7 / 20.01.2021
6
30
 
7
31
  * Reworked some tests
8
32
  * Updated to use Ruby 3.0.0
9
33
  * Added github actions
10
34
  * Updated to use ydbi 0.5.7
11
35
 
12
- === 1.1.6 / 23.01.2016
36
+ ## 1.1.6 / 23.01.2016
13
37
 
14
38
  * Updated to use ydbi 0.5.6
15
39
 
16
- === 1.1.5 / 23.01.2016
40
+ ## 1.1.5 / 23.01.2016
17
41
 
18
42
  * Remove unused parameter dict for update_fulltext_index
19
43
 
20
- === 1.1.4 / 13.12.2017
44
+ ## 1.1.4 / 13.12.2017
21
45
 
22
46
  * Drop text search dictionaries/configuration before recreating
23
47
  * Remove dictionary argument in fulltext search and index_definition
24
48
 
25
- === 1.1.3 / 12.12.2016
49
+ ## 1.1.3 / 12.12.2016
26
50
 
27
51
  * Avoid errors by always specifying "IF NOT EXISTS" when creating tables and indices
28
52
  * Add utility method get_server_version
29
53
  * Removed misleading check in generate_dictionary
30
54
 
31
- === 1.1.2 / 10.05.2016
55
+ ## 1.1.2 / 10.05.2016
32
56
 
33
57
  * requires now 'ydbi' and 'ydbd-pg'
34
58
 
35
- === 1.1.1 / 10.05.2016
59
+ ## 1.1.1 / 10.05.2016
36
60
 
37
61
  * Made tests pass under Ruby 1.9.3, 2.x
38
62
  * Updated to use minitest
39
63
 
40
- === 1.1.0 / 15.03.2013
64
+ ## 1.1.0 / 15.03.2013
41
65
 
42
66
  * Update dict source file name for multi languages
43
67
 
44
- === 1.0.9 / 15.03.2013
68
+ ## 1.0.9 / 15.03.2013
45
69
 
46
70
  * Update dictionary to be suitable for new tsearch2
47
71
  - generate_dictionary API is changed.
48
72
  - generate_dictionary needs dict source files(dict, affix, stop)
49
73
  into /usr/share/postgresql/tsearch_data.
50
74
 
51
- === 1.0.8 / 09.01.2012
75
+ ## 1.0.8 / 09.01.2012
52
76
 
53
77
  * Added exclusive control to update @accessed_by Hash variable in CacheEntry class using mutex (Patinfo-Invoice Error)
54
78
 
55
- === 1.0.7 / 27.12.2011
79
+ ## 1.0.7 / 27.12.2011
56
80
 
57
81
  * Debugged Hash iteration error during cleaning @fetched and @prefetched objects
58
82
 
59
- === 1.0.6 / 23.12.2011
83
+ ## 1.0.6 / 23.12.2011
60
84
 
61
85
  * Fix all the elements of odba_potentials and odba_exclude_vars to be Symbols for Ruby 1.9.3
62
86
 
63
- === 1.0.5 / 20.12.2011
87
+ ## 1.0.5 / 20.12.2011
64
88
 
65
89
  * Added attr_accessor :odba_persistent so we can update doctor addresses on ch.oddb.org
66
90
 
67
- === 1.0.4 / 12.12.2011
91
+ ## 1.0.4 / 12.12.2011
68
92
 
69
93
  * Fixed file lock process by using @file_lock flag variable to control it in application side
70
94
 
71
- === 1.0.3 / 09.12.2011
95
+ ## 1.0.3 / 09.12.2011
72
96
 
73
97
  * Debugged ODBA::Cache#next_id
74
98
 
75
- === 1.0.2 / 09.12.2011
99
+ ## 1.0.2 / 09.12.2011
76
100
 
77
101
  * Updated cache.rb persitatble.rb 18_19_loading_compatibility.rb to be compatible for both Ruby 1.8 and 1.9
78
102
 
79
- === 1.0.1 / 08.12.2011
103
+ ## 1.0.1 / 08.12.2011
80
104
 
81
105
  * Added file lock exclusive control to create a new odba_id between processes.
82
106
 
83
- === 1.0.0 / 20.12.2010
107
+ ## 1.0.0 / 20.12.2010
84
108
 
85
109
  * Add ODBA.cache.index_matches(index_name, substring)
86
110
 
data/README.md CHANGED
@@ -1,19 +1,95 @@
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
 
11
- Object Database Access - Ruby Software for ODDB.org Memory Management
24
+ * Object Database Access - Ruby Software for ODDB.org Memory Management
25
+ * https://dev.ywesee.com/ODBA/Index
12
26
 
13
27
  ## FEATURES/PROBLEMS:
14
28
 
15
29
  * There may still be an sql bottleneck. Has to be investigated further.
16
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.
17
93
 
18
94
  ## INSTALL:
19
95
 
@@ -24,6 +100,7 @@ Object Database Access - Ruby Software for ODDB.org Memory Management
24
100
  * Masamoi Hatakeyama
25
101
  * Zeno R.R. Davatz
26
102
  * Hannes Wyss (up to Version 1.0)
103
+ * Niklaus Giger (Porting to Ruby 2.x and 3.x, cleanup)
27
104
 
28
105
  ## LICENSE:
29
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