Module: Tengine::Core::KernelRuntime

Included in:
Kernel
Defined in:
lib/tengine/core/kernel_runtime.rb

Overview

Kernelにincludeされます

Instance Method Summary collapse

Instance Method Details

#ackObject



29
30
31
32
33
34
# File 'lib/tengine/core/kernel_runtime.rb', line 29

def ack
  unless @ack_called
    @ack_called = true
    @processing_headers.ack
  end
end

#ack?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/tengine/core/kernel_runtime.rb', line 36

def ack?
  @ack_called
end

#ack_policiesObject



16
17
18
# File 'lib/tengine/core/kernel_runtime.rb', line 16

def ack_policies
  @ack_policies ||= { }
end

#ack_policy_for(event) ⇒ Object



24
25
26
27
# File 'lib/tengine/core/kernel_runtime.rb', line 24

def ack_policy_for(event)
  Tengine.logger.debug("ack_policies: #{ack_policies.inspect}")
  ack_policy = ack_policies[event.event_type_name.to_s] || :at_first
end

#add_ack_policy(event_type_name, policy) ⇒ Object



20
21
22
# File 'lib/tengine/core/kernel_runtime.rb', line 20

def add_ack_policy(event_type_name, policy)
  ack_policies[event_type_name.to_s] = policy.to_sym
end

#all_submitted?Boolean

Returns:

  • (Boolean)


47
48
49
50
# File 'lib/tengine/core/kernel_runtime.rb', line 47

def 
  return false if @submitted_handlers.nil? || @handlers.nil?
  (@handlers - @submitted_handlers).empty?
end

#em_setup_blocksObject



56
57
58
# File 'lib/tengine/core/kernel_runtime.rb', line 56

def em_setup_blocks
  @em_setup_blocks ||= []
end

#processing_event?Boolean

Returns:

  • (Boolean)


53
# File 'lib/tengine/core/kernel_runtime.rb', line 53

def processing_event?; @processing_event; end

#safety_processing_headers(headers, event, ack_policy) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/tengine/core/kernel_runtime.rb', line 6

def safety_processing_headers(headers, event, ack_policy)
  @ack_called = false
  @processing_headers, @event, @ack_policy = headers, event, ack_policy
  begin
    yield if block_given?
  ensure
    @processing_headers, @event, @ack_policy = nil, nil, nil
  end
end

#submitObject



41
42
43
44
45
# File 'lib/tengine/core/kernel_runtime.rb', line 41

def submit
  if @submitted_handlers
    @submitted_handlers << @handler
  end
end