Skip to main content

build_postgres_election

Function build_postgres_election 

Source
pub async fn build_postgres_election(
    store_addrs: &[String],
    cfg: Option<Config>,
    tls_config: Option<TlsOption>,
    leader_value: String,
    store_key_prefix: String,
    candidate_lease_ttl: Duration,
    meta_lease_ttl: Duration,
    schema_name: Option<&str>,
    table_name: &str,
    lock_id: u64,
) -> Result<ElectionRef>
Expand description

Builds a Postgres-backed election implementation.

  • store_addrs - Postgres connection URLs; only the first address is used.
  • cfg - optional deadpool config to customize pool/session behavior.
  • tls_config - optional TLS settings for the Postgres connection.
  • leader_value - advertised address of this election candidate.
  • store_key_prefix - prefix for election and candidate keys.
  • candidate_lease_ttl - TTL for registered candidate metadata.
  • meta_lease_ttl - TTL for the elected leader metadata.
  • schema_name - optional schema containing the metadata table.
  • table_name - metadata KV table name used for election records.
  • lock_id - Postgres advisory lock id used by the election.