Trait ProtocolUpdateGenerator

Source
pub trait ProtocolUpdateGenerator: 'static {
    // Required method
    fn batch_groups(
        &self,
    ) -> Vec<Box<dyn ProtocolUpdateBatchGroupGenerator<'_> + '_>>;

    // Provided method
    fn insert_status_tracking_flash_transactions(&self) -> bool { ... }
}
Expand description

Generates batches for the protocol update. These are structured as:

  • One or more named batch groups
  • One or more batches under each batch group. Each batch is committed separately in the node. Separating into batches allows the node not to have to hold too much in memory at any given time.

The batch generation must be stateless (aside from the database), to allow the update to be resumed in the node mid-way through after a restart.

Therefore any transient state required between batches must be stored in the database, and we must ensure that whilst each batch group is executing, the content of the batch is fixed.

The use of lazy Generator traits is designed to allow the content of batch groups / batches to be resolved lazily (e.g. with input from the database).

Required Methods§

Source

fn batch_groups( &self, ) -> Vec<Box<dyn ProtocolUpdateBatchGroupGenerator<'_> + '_>>

Return the list of batch groups for the protocol update.

Each should be a fixed, conceptual step in the update process.

Provided Methods§

Implementors§