class Flor::Pro::Trap

Would it be worth the pain implementing bind:?

Public Instance Methods

pre_execute() click to toggle source
# File lib/flor/punit/trap.rb, line 225
def pre_execute

  @node['vars'] = {}
  @node['atts'] = []
  @node['fun'] = nil

  #unatt_unkeyed_children
end
receive() click to toggle source
Calls superclass method Flor::Procedure#receive
# File lib/flor/punit/trap.rb, line 291
def receive

  return [] if @node['trapped']

  super
end
receive_last() click to toggle source
# File lib/flor/punit/trap.rb, line 286
def receive_last

  receive_non_att
end
receive_non_att() click to toggle source
# File lib/flor/punit/trap.rb, line 234
def receive_non_att

  fun = @fcid > 0 ? payload['ret'] : nil

  points = att_a('point', 'points', nil)
  tags = att_a('tag', 'tags', nil)
  heats = att_a('heat', 'heats', nil)
  heaps = att_a('heap', 'heaps', nil)
  names = att_a('name', 'names', nil)
  pl = att('payload', 'pl') || 'trap'

  points = att_a(nil, nil) unless points || tags
  points = [ 'entered' ] if tags && ! points

  att_a('sig', 'signal', 'signals', [])
    .each { |sig| (points ||= []) << 'signal'; (names ||= []) << sig }

  points = points.uniq if points
  names = names.uniq if names

  bnid = att('bnid', 'bind') || parent || '0'

  msg =
    if fun
      apply(fun, [], tree[2], anid: false).first
    else
      wrap_reply.first
    end

  tra = {}
  tra['nid'] = nid
  tra['bnid'] = bnid
  tra['points'] = points
  tra['tags'] = tags
  tra['heaps'] = heaps
  tra['heats'] = heats
  tra['names'] = names
  tra['message'] = msg
  tra['pl'] = pl

  count = att('count')
  count = 1 if fun == nil # blocking mode implies count: 1
  tra['count'] = count if count

  tra['range'] = att('range', 'scope') || 'subnid'

  @node['trapped'] = true

  wrap('point' => 'trap', 'nid' => nid, 'trap' => tra) +
  (fun ? flank : [])
end
wrap_cancel_children(h={}) click to toggle source

“trap” keeps track of its children, but does not cascade ‘cancel’ to them, unless the cancel flavour is ‘kill’.

Calls superclass method Flor::Procedure#wrap_cancel_children
# File lib/flor/punit/trap.rb, line 301
def wrap_cancel_children(h={})

  h['flavour'] == 'kill' ? super : []
end