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 +4 -4
- data/.github/workflows/devenv.yml +30 -0
- data/.github/workflows/ruby.yml +8 -7
- data/.gitignore +11 -0
- data/{History.txt → History.md} +43 -19
- data/README.md +79 -2
- data/Rakefile +3 -15
- data/devenv.lock +171 -0
- data/devenv.nix +53 -0
- data/devenv.yaml +8 -0
- data/lib/odba/cache.rb +401 -344
- data/lib/odba/cache_entry.rb +42 -31
- data/lib/odba/connection_pool.rb +99 -72
- data/lib/odba/drbwrapper.rb +26 -18
- data/lib/odba/id_server.rb +20 -20
- data/lib/odba/index.rb +249 -215
- data/lib/odba/index_definition.rb +17 -17
- data/lib/odba/marshal.rb +15 -14
- data/lib/odba/odba.rb +40 -32
- data/lib/odba/odba_error.rb +4 -2
- data/lib/odba/persistable.rb +460 -414
- data/lib/odba/storage.rb +328 -277
- data/lib/odba/stub.rb +166 -153
- data/lib/odba/version.rb +1 -1
- data/lib/odba.rb +9 -9
- data/odba.gemspec +8 -3
- data/test/example.rb +47 -0
- data/test/helper.rb +6 -0
- data/test/suite.rb +7 -0
- data/test/test_array.rb +38 -33
- data/test/test_cache.rb +657 -622
- data/test/test_cache_entry.rb +51 -71
- data/test/test_connection_pool.rb +70 -25
- data/test/test_drbwrapper.rb +24 -19
- data/test/test_hash.rb +98 -89
- data/test/test_id_server.rb +30 -32
- data/test/test_index.rb +191 -158
- data/test/test_marshal.rb +15 -25
- data/test/test_persistable.rb +378 -369
- data/test/test_storage.rb +510 -471
- data/test/test_stub.rb +147 -135
- metadata +63 -20
- data/Guide.txt +0 -36
- data/Manifest.txt +0 -38
- data/install.rb +0 -1098
- data/lib/odba/18_19_loading_compatibility.rb +0 -77
data/lib/odba/marshal.rb
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
#-- Marshal -- odba -- 29.04.2004 -- hwyss@ywesee.com rwaltert@ywesee.com mwalder@ywesee.com
|
|
3
3
|
|
|
4
4
|
module ODBA
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
# Marshal is a simple extension of ::Marshal. To be able to store our data
|
|
6
|
+
# using the DBI-Interface, we need to escape invalid characters from the
|
|
7
|
+
# standard binary dump.
|
|
8
|
+
module Marshal
|
|
9
|
+
def self.dump(obj)
|
|
10
|
+
binary = ::Marshal.dump(obj)
|
|
11
|
+
binary.unpack1("H*")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.load(hexdump)
|
|
15
|
+
binary = [hexdump].pack("H*")
|
|
16
|
+
::Marshal.load(binary)
|
|
16
17
|
rescue => error
|
|
17
|
-
|
|
18
|
+
warn "#{error}: hexdump is #{hexdump.inspect} #{error.backtrace.join("\n")}"
|
|
18
19
|
Date.new
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
end
|
|
21
|
+
end
|
|
21
22
|
end
|
data/lib/odba/odba.rb
CHANGED
|
@@ -2,44 +2,52 @@
|
|
|
2
2
|
# ODBA -- odba -- 26.01.2007 -- hwyss@ywesee.com
|
|
3
3
|
|
|
4
4
|
module ODBA
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
# reader for the Cache server. Defaults to ODBA::Cache.instance
|
|
6
|
+
def self.cache
|
|
7
|
+
@cache ||= ODBA::Cache.instance
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# writer for the Cache server. You will probably never need this.
|
|
11
|
+
def self.cache=(cache_server)
|
|
12
|
+
@cache = cache_server
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# reader for the Marshaller. Defaults to ODBA.Marshal
|
|
16
|
+
def self.marshaller
|
|
17
|
+
@marshaller ||= ODBA::Marshal
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# writer for the Marshaller. Example: override the default Marshaller to
|
|
21
|
+
# serialize your objects in a custom format (yaml, xml, ...).
|
|
22
|
+
def self.marshaller=(marshaller)
|
|
23
|
+
@marshaller = marshaller
|
|
24
|
+
end
|
|
25
|
+
|
|
22
26
|
# peer two instances of ODBA::Cache
|
|
23
|
-
def
|
|
27
|
+
def self.peer peer
|
|
24
28
|
peer.register_peer ODBA.cache
|
|
25
29
|
ODBA.cache.register_peer peer
|
|
26
30
|
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
|
|
32
|
+
# reader for the Storage Server. Defaults to ODBA::Storage.instance
|
|
33
|
+
def self.storage
|
|
34
|
+
@storage ||= ODBA::Storage.instance
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# writer for the Storage Server. Example: override the default Storage Server
|
|
38
|
+
# to dump all your data in a flatfile.
|
|
39
|
+
def self.storage=(storage)
|
|
40
|
+
@storage = storage
|
|
41
|
+
end
|
|
42
|
+
|
|
36
43
|
# unpeer two instances of ODBA::Cache
|
|
37
|
-
def
|
|
44
|
+
def self.unpeer peer
|
|
38
45
|
peer.unregister_peer ODBA.cache
|
|
39
46
|
ODBA.cache.unregister_peer peer
|
|
40
47
|
end
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
|
|
49
|
+
# Convenience method. Delegates the transaction-call to the Cache server.
|
|
50
|
+
def self.transaction(&block)
|
|
51
|
+
ODBA.cache.transaction(&block)
|
|
52
|
+
end
|
|
45
53
|
end
|
data/lib/odba/odba_error.rb
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
#-- OdbaError -- odba -- 29.04.2004 -- hwyss@ywesee.com rwaltert@ywesee.com mwalder@ywesee.com
|
|
3
3
|
|
|
4
4
|
module ODBA
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
class OdbaError < RuntimeError
|
|
6
|
+
end
|
|
7
|
+
|
|
7
8
|
class OdbaResultLimitError < OdbaError
|
|
8
9
|
attr_accessor :limit, :size, :index, :search_term, :meta
|
|
9
10
|
end
|
|
11
|
+
|
|
10
12
|
class OdbaDuplicateIdError < OdbaError
|
|
11
13
|
end
|
|
12
14
|
end
|