odba 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +4 -0
  2. data/lib/odba.rb +1 -1
  3. data/lib/odba/cache.rb +11 -7
  4. metadata +3 -3
@@ -1,3 +1,7 @@
1
+ === 1.0.4 / 12.12.2011
2
+
3
+ * Fixed file lock process by using @file_lock flag variable to control it in application side
4
+
1
5
  === 1.0.3 / 09.12.2011
2
6
 
3
7
  * Debugged ODBA::Cache#next_id
@@ -11,5 +11,5 @@ require 'odba/index'
11
11
  require 'odba/odba'
12
12
 
13
13
  class Odba
14
- VERSION = '1.0.3'
14
+ VERSION = '1.0.4'
15
15
  end
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- # ODBA::Cache -- odba -- 09.12.2011 -- mhatakeyama@ywesee.com
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
- @cache_mutex.synchronize {
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
- #id = ODBA.storage.next_id
401
- dbname = ODBA.storage.instance_variable_get('@dbi').dbi_args.first.split(/:/).last
402
- id = new_id(dbname, ODBA.storage)
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
- - 3
9
- version: 1.0.3
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-09 00:00:00 +01:00
17
+ date: 2011-12-12 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency