Skip to main content

lead

Function lead 

Source
pub async fn lead(
    db: &Database,
    url: &str,
    __arg2: (Duration, bool, bool),
    __arg3: (Receiver<u32>, Duration),
    __arg4: (&'static str, String),
) -> Result<Option<LeaseFuture>, AppError>
Expand description

The master’s lease for role (master or standalone), being taken while the role’s other parts start when the schema is usable; else, with --migrate, taken now (a standby waits) and the schema migrated by its holder; taken as holder (the master’s ID). None when a shutdown is asked for while waiting. With --migrate, [database] change_notifications is applied by the holder.

§Errors

AppError::BadArgument for a schema to migrate without --migrate, as migrate_holding, or AppError::Db if the schema can’t be read; the lease future fails (the lease released) when the switch can’t be applied to an up-to-date schema.