odba 1.0.3 → 1.0.4
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.
- data/History.txt +4 -0
- data/lib/odba.rb +1 -1
- data/lib/odba/cache.rb +11 -7
- metadata +3 -3
data/History.txt
CHANGED
data/lib/odba.rb
CHANGED
data/lib/odba/cache.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
-
# ODBA::Cache -- odba --
|
3
|
+
# ODBA::Cache -- odba -- 12.12.2011 -- mhatakeyama@ywesee.com
|
4
4
|
# ODBA::Cache -- odba -- 29.04.2004 -- hwyss@ywesee.com rwaltert@ywesee.com mwalder@ywesee.com
|
5
5
|
|
6
6
|
require 'singleton'
|
@@ -19,7 +19,7 @@ module ODBA
|
|
19
19
|
include DRb::DRbUndumped
|
20
20
|
CLEANER_PRIORITY = 0 # :nodoc:
|
21
21
|
CLEANING_INTERVAL = 5 # :nodoc:
|
22
|
-
attr_accessor :cleaner_step, :destroy_age, :retire_age, :debug
|
22
|
+
attr_accessor :cleaner_step, :destroy_age, :retire_age, :debug, :file_lock
|
23
23
|
def initialize # :nodoc:
|
24
24
|
if(self::class::CLEANING_INTERVAL > 0)
|
25
25
|
start_cleaner
|
@@ -35,6 +35,7 @@ module ODBA
|
|
35
35
|
@cleaner_step = 500
|
36
36
|
@loading_stats = {}
|
37
37
|
@peers = []
|
38
|
+
@file_lock = false
|
38
39
|
end
|
39
40
|
# Returns all objects designated by _bulk_fetch_ids_ and registers
|
40
41
|
# _odba_caller_ for each of them. Objects which are not yet loaded are loaded
|
@@ -97,7 +98,7 @@ module ODBA
|
|
97
98
|
end
|
98
99
|
counter = 0
|
99
100
|
cutoff = offset + @cleaner_step
|
100
|
-
|
101
|
+
#@cache_mutex.synchronize {
|
101
102
|
holder.each_value { |value|
|
102
103
|
counter += 1
|
103
104
|
if(counter > offset && value.odba_old?(retire_time))
|
@@ -105,7 +106,7 @@ module ODBA
|
|
105
106
|
end
|
106
107
|
return cutoff if(counter > cutoff)
|
107
108
|
}
|
108
|
-
}
|
109
|
+
#}
|
109
110
|
cutoff
|
110
111
|
# every once in a while we'll get a 'hash modified during iteration'-Error.
|
111
112
|
# not to worry, we'll just try again later.
|
@@ -397,9 +398,12 @@ module ODBA
|
|
397
398
|
end
|
398
399
|
# Returns the next valid odba_id
|
399
400
|
def next_id
|
400
|
-
|
401
|
-
|
402
|
-
|
401
|
+
if @file_lock
|
402
|
+
dbname = ODBA.storage.instance_variable_get('@dbi').dbi_args.first.split(/:/).last
|
403
|
+
id = new_id(dbname, ODBA.storage)
|
404
|
+
else
|
405
|
+
id = ODBA.storage.next_id
|
406
|
+
end
|
403
407
|
@peers.each do |peer|
|
404
408
|
peer.reserve_next_id id rescue DRb::DRbError
|
405
409
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 4
|
9
|
+
version: 1.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-12-
|
17
|
+
date: 2011-12-12 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|