Skip to main content

switch_format

Function switch_format 

Source
fn switch_format(
    sharing: &Sharing<'_>,
    memory: &mut Memory,
    stores: &[Store],
    now_ms: i64,
    problems: &mut Vec<String>,
) -> Result<bool, String>
Expand description

This device takes format 2 (FORMAT), once and for all, before this exchange goes on:

  1. every file format 2 divides otherwise must read whole: one that does not (half written, broken by hand), or of no bytes while it held entries, keeps this device on format 1 for now, said (share-format-wait), and the switch is tried at the next exchange;
  2. what changed in them since the last look goes out first, in format 1 and as format 1 names it (flush): a removal, a corrected session reach the devices that still read format 1;
  3. each element of a list format 2 names by ids is given its id in the file, once, through the file’s lock, the file as it was kept first among the earlier versions (give_ids); from then on every element carries an id of its own, which changing it never changes;
  4. the memory is said in format 2’s names, each renamed entry’s last clock kept as its floor (Floor).

Returns whether it did. Stopped half way, the next exchange does it again from where the files and the memory are: the ids already written stay, what was sent is known.