module Delayer::Deferred::Deferredable::NodeSequence

Constants

AWAIT
AWAIT_C
BURST_OUT
CALL_CHILD
CONNECTED
FRESH
GENOCIDE
GRAFT
GRAFT_C
PASS
PASS_C
RESERVED
RESERVED_C
ROTTEN
RUN
RUN_C
SEQUENCE_LOCK
STOP
WAIT

Public Instance Methods

activated?() click to toggle source
# File lib/delayer/deferred/deferredable/node_sequence.rb, line 149
def activated?
  ![FRESH, CONNECTED, RUN, RUN_C].include?(sequence)
end
change_sequence(flow, &block) click to toggle source

このメソッドはスレッドセーフです

# File lib/delayer/deferred/deferredable/node_sequence.rb, line 130
def change_sequence(flow, &block)
  SEQUENCE_LOCK.synchronize do
    old_seq = sequence
    new_seq = @sequence = sequence.pull(flow)
    (@seq_logger ||= [old_seq]) << new_seq
    if block
      result = block.()
      on_sequence_changed(old_seq, flow, new_seq)
      result
    else
      on_sequence_changed(old_seq, flow, new_seq)
      nil
    end
  end
end
on_sequence_changed(old_seq, flow, new_seq) click to toggle source
# File lib/delayer/deferred/deferredable/node_sequence.rb, line 146
def on_sequence_changed(old_seq, flow, new_seq)
end
sequence() click to toggle source
# File lib/delayer/deferred/deferredable/node_sequence.rb, line 125
def sequence
  @sequence ||= FRESH
end
spoiled?() click to toggle source
# File lib/delayer/deferred/deferredable/node_sequence.rb, line 153
def spoiled?
  sequence == ROTTEN || sequence == GENOCIDE
end