class Bud::BudChannel

Channels are a different type of collection in that they represent two distinct collections, one each for incoming and outgoing. The incoming side makes use of @storage and @delta, whereas the outgoing side only deals with @pending. XXX Maybe we should be using aliases instead.

Public Instance Methods

<=(o) click to toggle source
# File lib/bud/collections.rb, line 1065
def <=(o)
  raise Bud::CompileError, "illegal use of <= with channel '#{@tabname}' on left"
end
bootstrap() click to toggle source
# File lib/bud/collections.rb, line 927
def bootstrap
  # override BudCollection; pending should not be moved into delta.
end
invalidate_cache() click to toggle source
# File lib/bud/collections.rb, line 961
def invalidate_cache
end
payloads(&blk) click to toggle source

project to the non-address fields

# File lib/bud/collections.rb, line 1023
def payloads(&blk)
  return self.pro(&blk) if @is_loopback

  if @payload_struct.nil?
    payload_cols = cols.dup
    payload_cols.delete_at(@locspec_idx)
    @payload_struct = Bud::TupleStruct.new(*payload_cols)
    @payload_colnums = payload_cols.map {|k| cols.index(k)}
  end

  retval = self.pro do |t|
    @payload_struct.new(*t.values_at(*@payload_colnums))
  end
  retval = retval.pro(&blk) unless blk.nil?
  return retval
end

Private Instance Methods

remove_at_sign!(cols) click to toggle source
# File lib/bud/collections.rb, line 932
def remove_at_sign!(cols)
  i = cols.find_index {|c| c.to_s.start_with? "@"}
  unless i.nil?
    cols[i] = cols[i].to_s.delete('@').to_sym
  end
  return i
end
split_locspec(t, idx) click to toggle source
# File lib/bud/collections.rb, line 941
def split_locspec(t, idx)
  begin
    lsplit = t[idx].split(':')
    lsplit[1] = lsplit[1].to_i
    return lsplit
  rescue Exception => e
    raise Bud::Error, "illegal location specifier in tuple #{t.inspect} for channel \"#{qualified_tabname}\": #{e.to_s}"
  end
end