Class: Bud::ScannerElement
- Inherits:
-
PushElement
- Object
- BudCollection
- PushElement
- Bud::ScannerElement
- Defined in:
- lib/bud/executor/elements.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#force_rescan ⇒ Object
Returns the value of attribute force_rescan.
-
#invalidate_set ⇒ Object
readonly
Returns the value of attribute invalidate_set.
-
#rescan_set ⇒ Object
readonly
Returns the value of attribute rescan_set.
Attributes inherited from PushElement
#elem_name, #found_delta, #invalidated, #outputs, #pendings, #wired_by
Attributes inherited from BudCollection
#accumulate_tick_deltas, #bud_instance, #cols, #invalidated, #is_source, #key_cols, #new_delta, #pending, #scanner_cnt, #struct, #tabname, #wired_by
Instance Method Summary collapse
- #add_rescan_invalidate(rescan, invalidate) ⇒ Object
-
#initialize(elem_name, bud_instance, collection_in, the_schema = collection_in.schema, &blk) ⇒ ScannerElement
constructor
A new instance of ScannerElement.
-
#invalidate_at_tick(rescan, invalidate) ⇒ Object
What should be rescanned/invalidated if this scanner’s collection were to be invalidated.
- #rescan ⇒ Object
- #rescan_at_tick ⇒ Object
- #scan(first_iter) ⇒ Object
Methods inherited from PushElement
#*, #<<, #all?, #any?, #argagg, #argmax, #argmin, #check_wiring, #each_with_index, #flush, #group, #include?, #insert, #inspected, #invalidate_cache, #invalidate_tables, #join, #member?, #merge, #none?, #notin, #on_include?, #one?, #print_wiring, #pro, #push_out, #push_predicate, #reduce, #set_block, #sort, #stratum_end, #tick, #tick_deltas, #wire_to, #wirings
Methods inherited from BudCollection
#*, #<<, #<=, #[], #argagg, #argmax, #argmin, #bootstrap, #canonicalize_col, #close, #do_insert, #each, #each_delta, #each_raw, #each_tick_delta, #each_with_index, #empty?, #exists?, #flat_map, #flush, #flush_deltas, #group, #has_key?, #include?, #init_schema, #insert, #inspect, #inspected, #keys, #length, #merge, #non_temporal_predecessors, #notin, #null_tuple, #pending_merge, #positive_predecessors, #prep_aggpairs, #pro, #qualified_tabname, #reduce, #register_coll_expr, #rename, #schema, #sort, #tick, #tick_deltas, #tick_metrics, #to_push_elem, #uniquify_tabname, #val_cols, #values
Methods included from Enumerable
Constructor Details
#initialize(elem_name, bud_instance, collection_in, the_schema = collection_in.schema, &blk) ⇒ ScannerElement
Returns a new instance of ScannerElement.
448 449 450 451 452 453 454 455 |
# 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 |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
444 445 446 |
# File 'lib/bud/executor/elements.rb', line 444 def collection @collection end |
#force_rescan ⇒ Object
Returns the value of attribute force_rescan.
446 447 448 |
# File 'lib/bud/executor/elements.rb', line 446 def force_rescan @force_rescan end |
#invalidate_set ⇒ Object (readonly)
Returns the value of attribute invalidate_set.
445 446 447 |
# File 'lib/bud/executor/elements.rb', line 445 def invalidate_set @invalidate_set end |
#rescan_set ⇒ Object (readonly)
Returns the value of attribute rescan_set.
445 446 447 |
# File 'lib/bud/executor/elements.rb', line 445 def rescan_set @rescan_set end |
Instance Method Details
#add_rescan_invalidate(rescan, invalidate) ⇒ Object
472 473 474 475 476 477 478 479 480 481 482 483 484 |
# 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) ⇒ Object
What should be rescanned/invalidated if this scanner’s collection were to be invalidated.
467 468 469 470 |
# File 'lib/bud/executor/elements.rb', line 467 def invalidate_at_tick(rescan, invalidate) @rescan_set = rescan @invalidate_set = invalidate end |
#rescan ⇒ Object
457 458 459 |
# File 'lib/bud/executor/elements.rb', line 457 def rescan @rescan || @collection.invalidated end |
#rescan_at_tick ⇒ Object
461 462 463 |
# 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) ⇒ Object
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
# 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 |