require 'rubygems' require 'bud' # Reliable broadcast with a fixed set of nodes that act as both senders and # receivers. That is, any node can send a message; when a node receives a # message, it rebroadcasts the message to all other nodes. This ensures that we # can tolerate the failure of nodes that have partially completed message # sends. We assume that all nodes configured with the same set of values in # "node". To ensure that log entries are globally unique, they are identified # with a pair: (note that "creator" is the node that # originated the log entry, which is often different from the node that sent a # message containing that entry.) class BroadcastAll include Bud state do sealed :node, [:addr] table :log, [:id] => [:val] channel :chn, [:@addr, :id] => [:val] end bloom do chn <~ (node * log).pairs {|n,l| n + l} log <= chn.payloads end end