Skip to main content

arbitrate

Function arbitrate 

Source
pub fn arbitrate(
    app_id: &str,
    version: &str,
    on_second: Arc<dyn Fn(SecondInstance) + Send + Sync>,
) -> Arbitration
Expand description

Arbitrate single-instance for app_id.

Naming rule: the service is named <app id>-shell after the id is ASCII-lowercased and every character outside [a-z0-9-] becomes - (so "app.mailright" and "app-mailright" are the same app). An empty id, or one whose service name would exceed 48 bytes (id longer than 42), returns Arbitration::InvalidAppId, never Arbitration::Unavailable: a naming mistake is not an environment failure and must not be treated as “arbitration is off”. The caller must not continue as primary on InvalidAppId or Unavailable.