hydroflow
hydroflow copied to clipboard
Add arbitrary function support for partitioning in datalog
My partitioning transformation introduces the distribution function slotPartition
below.
p2a(i, no, slot, i, num, p, t') :- FilledHoles(no, slot, l, t), id(i), ballot(num, l, t), acceptors(a), slotPartition(a, slot, p), choose(_, t')
Generically, it can take any set of variables in the original output fact i, no, slot, i, num, a, t'
and determine a new destination p
.
In Paxos, since we partition on slot, it only needs the slot number slot
and acceptor a
.
The function itself will be a mapping from each location a
to its set of partitions p
, using slot mod n
to find the right partition, where n
is the number of partitions.
Example pulled from here, more available in the same file.