class Bud::ScannerElement

Attributes

collection[R]
force_rescan[RW]
invalidate_set[R]
rescan_set[R]

Public Class Methods

new(elem_name, bud_instance, collection_in, the_schema=collection_in.schema, &blk) click to toggle source
Calls superclass method Bud::PushElement::new
# File lib/bud/executor/elements.rb, line 448
def initialize(elem_name, bud_instance, collection_in,
               the_schema=collection_in.schema, &blk)
  super(elem_name, bud_instance, collection_in.qualified_tabname, the_schema)
  @collection = collection_in
  @rescan_set = []
  @invalidate_set = []
  @force_rescan = false
end

Public Instance Methods

add_rescan_invalidate(rescan, invalidate) click to toggle source
# File lib/bud/executor/elements.rb, line 472
def add_rescan_invalidate(rescan, invalidate)
  # If the collection is to be invalidated, the scanner needs to be in
  # rescan mode
  rescan << self if invalidate.member? @collection

  # Pass the current state to each output collection and see if they end up
  # marking this node for rescan
  invalidate_tables(rescan, invalidate)

  # Note also that this node can be nominated for rescan by a target node;
  # in other words, a scanner element can be set to rescan even if the
  # collection is not invalidated.
end
invalidate_at_tick(rescan, invalidate) click to toggle source

What should be rescanned/invalidated if this scanner's collection were to be invalidated.

# File lib/bud/executor/elements.rb, line 467
def invalidate_at_tick(rescan, invalidate)
  @rescan_set = rescan
  @invalidate_set = invalidate
end
rescan() click to toggle source
# File lib/bud/executor/elements.rb, line 457
def rescan
  @rescan || @collection.invalidated
end
rescan_at_tick() click to toggle source
# File lib/bud/executor/elements.rb, line 461
def rescan_at_tick
  @collection.invalidate_at_tick # need to scan afresh if collection invalidated.
end
scan(first_iter) click to toggle source
# File lib/bud/executor/elements.rb, line 486
def scan(first_iter)
  if @force_rescan
    @collection.each_raw {|item| push_out(item)}
    @force_rescan = false
  elsif first_iter
    if rescan
      @collection.each_raw {|item| push_out(item)}
    else
      # In the first iteration, tick_delta would be non-null IFF the
      # collection has grown in an earlier stratum
      @collection.each_tick_delta {|item| push_out(item)}
    end
  end

  # send deltas out in all cases
  @collection.each_delta {|item| push_out(item)}
end