Skip to main content

Module ports

Module ports 

Source
Expand description

Port lease allocation.

Assignment is deterministic: the first four bytes of SHA-256(repo_id:branch) are interpreted as a big-endian u32, reduced modulo the configured range size, and offset by port_range_start. Collisions fall back to sequential probing.

Functions§

allocate_port
Allocate a port for a branch by probing from preferred port, wrapping around.
compute_preferred_port
Compute the preferred port for a branch within a port range.
is_lease_expired
Check if a port lease is expired.
make_lease
Build a PortLease with 8-hour TTL.
renew_lease
Renew a lease — extend expires_at by another 8 hours from now.
sweep_expired_leases
Sweep expired leases from the map, returning how many were removed.