5.2. Poset Syncing¶
This module implements functions useful for syncing posets.
-
aleph.actions.poset_syncing.
dehash_parents
(poset, U)¶ Substitute units from the poset for hashes in U’s parent list and set the height field. To be called on units received from the network.
-
aleph.actions.poset_syncing.
order_units_topologically
(units_list)¶ Outputs a topological order of units_list. More formally it outputs a list top_list such that: whenever U, V are in units_list and V is a parent of U then V appears before U in top_list. Note: this does not necessarily preserve the ordering in the poset!
- Parameters
unit_list (list) – the list of units to sort
- Returns
topologically sorted unit_list
-
aleph.actions.poset_syncing.
poset_info
(poset)¶ A short representation of the poset state, for syncing purposes.
- Parameters
poset (Poset) – the poset which state we want to receive
- Returns
A list of lists of pairs (height, hash), with the heights and hashes of maximal elements per process in the poset.
-
aleph.actions.poset_syncing.
requested_units_to_send
(poset, tops, requests)¶ Collect units to send given the provided request.
- Parameters
poset (Poset) – the poset which is supposed to be the source of the units
tops (list) – the short representation of the receiving poset’s top known units made by pid
requests (list) – the hashes of the requested units
- Returns
units created by pid the other poset requested and has not yet seen
-
aleph.actions.poset_syncing.
units_to_send
(poset, info, requests=None)¶ Determine which units to send to a poset which has the given info.
- Parameters
poset (Poset) – the poset which is supposed to be the source of the units
info (list) – the short representation of the receiving poset’s state
requests (list) – a list of explicitly requested units, per process
- Returns
units the other poset should receive to catch up to us
-
aleph.actions.poset_syncing.
units_to_send_with_pid
(poset, tops, pid)¶ Determine which units created by pid to send to a poset which has the top known units of pid as given. Also make a list of units in tops we don’t recognize.
- Parameters
poset (Poset) – the poset which is supposed to be the source of the units
tops (list) – the short representation of the receiving poset’s top known units made by pid
pid (int) – the id of the creator of units we are interested in
- Returns
units created by pid the other poset should receive to catch up to us, and a list of tops we don’t recognize