Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

re- Closes #170 by changing unit heartbeat and timer to expect a Time…

… object as the payload of periodics, rather than a string. also, easier toggling for tracing
  • Loading branch information...
commit a5f88e3ac41125e6a10d847b0c556576a8658ef6 1 parent a2aeb4d
@palvaro palvaro authored
View
4 heartbeat/heartbeat.rb
@@ -59,7 +59,7 @@ module HeartbeatAgent
bloom :reckon do
#stdio <~ heartbeat {|h| ["HB RCV @ #{h.src} from #{h.sender}"]}
heartbeat_buffer <= heartbeat {|h| [h.src, h.sender, h.payload] }
- heartbeat_log <= (hb_timer * heartbeat_buffer).pairs {|t, h| [h.peer, h.sender, Time.parse(t.val).to_f, h.payload] }
+ heartbeat_log <= (hb_timer * heartbeat_buffer).pairs {|t, h| [h.peer, h.sender, t.val.to_f, h.payload] }
heartbeat_buffer <- (hb_timer * heartbeat_buffer).rights
end
@@ -68,7 +68,7 @@ module HeartbeatAgent
last_heartbeat_stg <= heartbeat_log.argagg(:max, [heartbeat_log.peer], heartbeat_log.time)
last_heartbeat <= last_heartbeat_stg.group([last_heartbeat_stg.peer, last_heartbeat_stg.sender, last_heartbeat_stg.time], choose(last_heartbeat_stg.payload))
to_del <= (heartbeat_log * hb_timer).pairs do |log, t|
- if ((Time.parse(t.val).to_f) - log.time) > HB_EXPIRE
+ if (t.val.to_f - log.time) > HB_EXPIRE
log
end
end
View
6 test/tc_2pc.rb
@@ -14,9 +14,9 @@ class TPCA
class Test2PC < Test::Unit::TestCase
def test_singlenode
- t = TPCM.new(:port => 32345)
- t2 = TPCA.new(:port => 32346)
- t3 = TPCA.new(:port => 32347)
+ t = TPCM.new(:port => 32345, :tag => "master", :trace => false)
+ t2 = TPCA.new(:port => 32346, :tag => "a1", :trace => false)
+ t3 = TPCA.new(:port => 32347, :tag => "a2", :trace => false)
t.add_member <+ [['localhost:32346']]
t.add_member <+ [['localhost:32347']]
t.run_bg
View
4 test/tc_voting.rb
@@ -27,12 +27,12 @@ def initialize(args)
def start_kind(kind, port)
t = nil
- eval "t = #{kind}.new(@opts.merge(:port => #{port}, :tag => #{port}))"
+ eval "t = #{kind}.new(@opts.merge(:port => #{port}, :tag => #{port}, :trace => false))"
return t
end
def start_three(one, two, three, kind)
- t = VM.new(@opts.merge(:port => one))
+ t = VM.new(@opts.merge(:port => one, :tag => "master", :trace => false))
t2 = start_kind(kind, two)
t3 = start_kind(kind, three)
View
4 timers/progress_timer.rb
@@ -24,11 +24,11 @@ module ProgressTimer
bloom :timer_logic do
alrm_buf <= set_alarm
temp :cyc <= (alrm_buf * timer)
- timer_state <= cyc.map {|s, t| [s.name, Time.parse(t.val).to_f, s.time_out]}
+ timer_state <= cyc.map {|s, t| [s.name, t.val.to_f, s.time_out]}
alrm_buf <- cyc.map{|s, t| s}
alarm <= (timer_state * timer).map do |s, t|
- if Time.parse(t.val).to_f - s.start_tm > s.time_out
+ if t.val.to_f - s.start_tm > s.time_out
[s.name, s.time_out]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.