Skip to main content

resolve_instance_id

Function resolve_instance_id 

Source
pub fn resolve_instance_id(db: Option<&MetadataDb>, port: u16) -> String
Expand description

Resolve the persistent instance id for the server listening on port, generating and storing one on first boot. A legacy port-less id (written by older versions) is adopted by the first port that asks — renamed to the port-scoped key so a second server on the same DB mints its own id instead of colliding. When the metadata DB is unavailable (MOLD_DB_DISABLE=1, open failure), falls back to a fresh ephemeral UUID — callers resolve once at startup and hold the result, making the fallback per-process.